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

add fragment cache (to match turbo cache) #45

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tchak
Copy link
Owner

@tchak tchak commented Jan 17, 2025

turbo will aggressively cache pages when rendering and use the cache for history navigation. If used in combination with turbo rendering (you really should override turbo rendering with our implementation of morph), the new cache option will help.

the scenario is as follows:

  • A page is rendered with the react fragment
  • navigate with turbo to a new page
  • turbo caches the page with the fragment containing either react rendered html or it will be empty (depending on the moment)
  • navigate back by pressing the back button
  • the cached page is reapplied. When coldwired tries to render the react fragment the source of the fragment is pre-rendered html or an empty string instead of JSX

This patch will preserve the fragment JSX source and try to restore it based on dom ids (they will be preserved in turbo cache)

Copy link

changeset-bot bot commented Jan 17, 2025

⚠️ No Changeset found

Latest commit: 70320cb

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

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.

1 participant