Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: #6458 add timestamp to force revalidating data #6880

Closed
wants to merge 7 commits into from

Conversation

chientrm
Copy link
Contributor

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Tests

  • Run the tests with pnpm test and lint the project with pnpm lint and pnpm check

Changesets

  • If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpm changeset and following the prompts. All changesets should be patch until SvelteKit 1.0

@changeset-bot
Copy link

changeset-bot bot commented Sep 19, 2022

🦋 Changeset detected

Latest commit: 92c7f53

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@sveltejs/kit Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@dummdidumm
Copy link
Member

Wouldn't "cache-control": "private no-store" on the response achieve the same without additional JS code on the client? That's what's done in #6809

@chientrm
Copy link
Contributor Author

chientrm commented Sep 19, 2022

Wouldn't "cache-control": "private no-store" on the response achieve the same without additional JS code on the client? That's what's done in #6809

When you setup Custom Domain using Cloudflare Pages, the data response headers is somehow replaced with cache-control: max-age=14400. 🤦 I already tried your pull request #6809 and purge my Cloudflare Cache 😶‍🌫️ with my personal SvelteKit build @chientrm/kit/v/1.0.0-next.484-1

No issue when using default subdomain *.pages.dev.

Can't reproduce since it require a custom domain. 🤕🤕🤕

@Rich-Harris
Copy link
Member

That sounds like an extremely serious bug in Cloudflare Pages. If that's the case, this would be only one manifestation of it. I don't think it would be appropriate to work around it here.

At the very least, it would need a reproduction (and if one of the steps is 'set up a custom domain on Cloudflare Pages' then so be it)

@chientrm
Copy link
Contributor Author

chientrm commented Sep 20, 2022

That sounds like an extremely serious bug in Cloudflare Pages. If that's the case, this would be only one manifestation of it. I don't think it would be appropriate to work around it here.

At the very least, it would need a reproduction (and if one of the steps is 'set up a custom domain on Cloudflare Pages' then so be it)

This repository: test-sk-cf-custom-domain

The page with default cf subdomain: test-sk-cf-custom-domain.pages.dev

The page with custom domain: test-sk-cf-custom-domain.dstserver.cloud

Step to reproduce:

  1. Browse page
  2. Click Invalidate several times.
  3. Reload page.
  4. Click Invalidate several times.

Expected: Text Refreshing: true appear for 3 seconds then being replaced with Refreshing: false.

Actual:

  • For default subdomain: Same as expected
  • For custom domain: Sometimes Invalidate do load new data, sometimes it load from disk cache.

CF cache settings: all default.

@Rich-Harris
Copy link
Member

I note that the repro's lockfile specifies next.489 as the version. cache-control: private, no-store was added in next.490. Can you upgrade to the latest Kit and see if the bug is still present?

@chientrm
Copy link
Contributor Author

I note that the repro's lockfile specifies next.489 as the version. cache-control: private, no-store was added in next.490. Can you upgrade to the latest Kit and see if the bug is still present?

As your suggestion, I have done these steps:

  1. Upgrade SvelteKit to latest version next.493.
    After that, CF build failed with this error: Error: Failed to publish your Function. Got error: Error 8000057: Rules must start with '/' in _routes.json.
    Remove static/favicon.png help fix the _routes.json related error. This looks like another bug since a new PR feat: Cloudflare Pages _routes.json specification (#6441) #6530 🤔 .
  2. Purge all CF cache on site dstserver.cloud
  3. Repeat the testing steps. I did tried reload pages several times,
  4. Results
    Screen Shot 2022-09-22 at 7 02 02 AM
    Work as intended 👍

@chientrm chientrm closed this Sep 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants