-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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: clear the content layer cache when the Astro config changes #12767
Conversation
🦋 Changeset detectedLatest commit: 2c1cbc6 The changes in this PR will be included in the next version bump. 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 |
CodSpeed Performance ReportMerging #12767 will not alter performanceComparing Summary
|
Huh. They passed locally but now aren't. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests are failing but looks good to me in principle!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should change how we hash the config.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Oh that isn't good! I'll look into it tomorrow |
I'm going to switch back to the safe stringify approach because it looks like deterministic-object-hash doesn't have any circular dependency handling or any other handling of excessively deep objects. That's fine for simple things like the image transforms, but astro config can be complex. |
Changes
Currently the content layer cache is invalidated if the content config or Astro version changes. However this causes problems if there are changes in the Astro config that also affect the stored data. This can include things like markdown settings, but potentially lots of other things.
The apporach this PR takes is to hash everything except integrations, adapters and vite config. It switches the digest function to use a safe stringify function in case the Astro config includes circular refs.
Closes #12761
Testing
Adds a test case
Docs