Skip to content

Make sure to use the correct version for adaptive content #3487

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

Merged
merged 10 commits into from
Jul 24, 2025

Conversation

conico974
Copy link
Contributor

@conico974 conico974 commented Jul 18, 2025

Use contextId from PublishedContentSite to force refresh RSC data based on it.
When the claims change, the whole RSC data would get refreshed.

Copy link

changeset-bot bot commented Jul 18, 2025

⚠️ No Changeset found

Latest commit: 2afb7a7

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

Copy link

argos-ci bot commented Jul 18, 2025

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
customers-v2 (Inspect) ✅ No changes detected - Jul 24, 2025, 9:18 AM
v2-cloudflare (Inspect) 👍 Changes approved 1 changed Jul 24, 2025, 9:22 AM
v2-vercel (Inspect) 👍 Changes approved 1 changed Jul 24, 2025, 9:18 AM

@SamyPesse SamyPesse self-requested a review July 18, 2025 18:26
@conico974
Copy link
Contributor Author

I've spent way too much time trying to understand what's going on here.
It seems that the staleTimes that we set for the client is not always respected.
Sometimes before the 5 minutes where it should serve stale requests from the client cache, it still triggers a request.

It's not perfect, but this PR should allow us to be safe and have a good enough client cache.
The only downsides is the "ugly" URL that we get

@conico974 conico974 marked this pull request as ready for review July 21, 2025 17:31
Copy link
Member

@SamyPesse SamyPesse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While the approach makes sense, it forces us to have ugly URls and also to handle ALL urls everywhere.

Can we instead have an effect like:

React.useEffect(() => {
   next.clearRouterCacheSomehow();
}, [cacheContextKey]);

?

@conico974 conico974 changed the title Add adaptive content hash to avoid caching issues Make sure to use the correct version for adaptive content Jul 22, 2025
@conico974
Copy link
Contributor Author

One thing with it right now, for unsigned claims using a <Link> with prefetch will cause trouble because the cookies would be set before actually clicking on it.
It could be interesting to provide a custom button for that so that we can more easily control that

@conico974 conico974 merged commit 04c8026 into main Jul 24, 2025
16 checks passed
@conico974 conico974 deleted the gbo/adaptive-hash branch July 24, 2025 09:40
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.

2 participants