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 caching for Content Versioning #20153

Merged
merged 5 commits into from
Oct 26, 2023
Merged

Fix caching for Content Versioning #20153

merged 5 commits into from
Oct 26, 2023

Conversation

azrikahar
Copy link
Contributor

Scope

What's changed:

  • Ensured cache value contains content version values when version query parameter is used
    Previously the version query param augments the payload after setCacheValue is called, so the cached data is actually incorrect. This PR ensures the augmentation happens before the cache is saved.

  • Added auto cache purging for Content Version saves
    Uses the same code over here:

    // check if cache should be cleared
    const { cache } = getCache();
    if (shouldClearCache(cache, undefined, collection)) {
    await cache.clear();
    }

    which was added in Add Auto Cache Purging to Sorting Utility #19115.

Potential Risks / Drawbacks

  • N/A at the moment

Review Notes / Questions


Fixes #20133

@changeset-bot
Copy link

changeset-bot bot commented Oct 24, 2023

🦋 Changeset detected

Latest commit: 49e2dcc

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

This PR includes changesets to release 2 packages
Name Type
@directus/api Patch
directus 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

@paescuj
Copy link
Member

paescuj commented Oct 24, 2023

Partially unrelated, but should we mention both Content Version saves and also util sort (by #19115) in the description here:

Or simply rephrase the sentence more generally. Could you do that right in this PR? 🙏

@azrikahar
Copy link
Contributor Author

Or simply rephrase the sentence more generally. Could you do that right in this PR? 🙏

Updated via 476a62d 👍

Copy link
Member

@paescuj paescuj left a comment

Choose a reason for hiding this comment

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

Great work 🥇 Looks & works fine!

@paescuj paescuj merged commit c80f8ee into main Oct 26, 2023
12 checks passed
@paescuj paescuj deleted the fix/content-versioning-cache branch October 26, 2023 09:25
@github-actions github-actions bot added this to the Next Patch Release milestone Oct 26, 2023
br-rafaelbarros pushed a commit to personal-forks/directus-source that referenced this pull request Nov 7, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

saving a version doesn't trigger cache auto purge
2 participants