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 nocache placeholder appearing in responses #6838

Merged

Conversation

arthurperton
Copy link
Contributor

Fixes #6725 and fixes #6543.

If the response is not cached (because it is a 404 or a draft viewed in Live Preview) the placeholders are now still replaced with the actual content, to get valid output.

Copy link
Member

@jasonvarga jasonvarga left a comment

Choose a reason for hiding this comment

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

The extra conditions weren't really necessary. I've just made it so it'll just make the replacements in a simple else. always (except for redirects).

It's a bit unfortunate that the method is called replaceInCachedResponse even though now it's technically not "the cached response". It's just ... the response. Oh well. Better than a breaking change.

Thanks!

@jasonvarga jasonvarga merged commit cbc0160 into statamic:3.3 Oct 13, 2022
@arthurperton arthurperton deleted the issue/issue-6725-nocache-draft-preview branch October 14, 2022 05:25
@dominikradl
Copy link
Contributor

Unfortunately, throwing a {{ 404 }} between {{ nocache }} tags still shows the NOCACHE_PLACEHOLDER strings. We have to do this inside {{ nocache }} because its dependent on the login status.

Can you reproduce this?

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.

Draft entries with nocache tag in template show placeholder in Live Preview {nocache} tag and 404 pages
3 participants