Skip to content

fix: clear stale cache on blog pagination unmount#228

Merged
LZylstra merged 5 commits intomainfrom
bry/fix-eyebrow-review-2
Mar 24, 2026
Merged

fix: clear stale cache on blog pagination unmount#228
LZylstra merged 5 commits intomainfrom
bry/fix-eyebrow-review-2

Conversation

@MattatDirectus
Copy link
Copy Markdown
Contributor

Summary

  • CardGroupDynamic stores fetched cards/count under a static useAsyncData key. When a user navigates to a blog post and back, the component remounts with page = 1 but the cache still holds data from whichever page they last visited — causing stale results and broken pagination.
  • Fix: call clearNuxtData on unmount for both the cards and count keys so the next mount always fetches fresh data for the current page.

Test plan

  • Navigate to blog listing, paginate to page 2
  • Open a blog post, click Back
  • Confirm page 1 results load correctly
  • Confirm clicking pagination buttons updates results normally

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 12, 2026

Deploy Preview for directus-website failed. Why did it fail? →

Name Link
🔨 Latest commit 1f1c909
🔍 Latest deploy log https://app.netlify.com/projects/directus-website/deploys/69c2bde43dcf9700082003e4

@LZylstra LZylstra self-requested a review March 18, 2026 20:37
Copy link
Copy Markdown
Contributor

@LZylstra LZylstra left a comment

Choose a reason for hiding this comment

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

LGTM!

@LZylstra LZylstra merged commit 0531390 into main Mar 24, 2026
2 of 7 checks passed
@LZylstra LZylstra deleted the bry/fix-eyebrow-review-2 branch March 24, 2026 17:28
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.

3 participants