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

[5.x] Fallback to nocache content when request is missing the Cache middleware #9406

Conversation

duncanmcclean
Copy link
Member

This pull request fixes an issue with the {{ nocache }} tag on custom routes that aren't using Statamic's Cache middleware, used for static caching.

Previously, if you used the {{ nocache }} tag or it's Blade directive counterpart on a custom route without the middleware, NOCACHE_PLACEHOLDER text will have been displayed.

This PR fixes that and simply falls back to the intended contents / view when the response isn't being statically cached.

Fixes #6744.

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 failing test that's happening now would have happened before too if you ran it by itself.

Since you had a static property, its value sticks around between tests.

So lets say you had one test that set that to true, when it got to this test, it would still be true. This made it pass, but it shouldn't have.

Anyway, the remaining failing test is just some whitespace changes. I'll dig in some more when I have more time. I'm not sure that editing the test is the answer. There must be a reason it changed.

@duncanmcclean duncanmcclean changed the title [4.x] Fallback to nocache content when request is missing the Cache middleware [5.x] Fallback to nocache content when request is missing the Cache middleware May 13, 2024
@duncanmcclean duncanmcclean changed the base branch from 4.x to 5.x May 13, 2024 11:43
duncanmcclean and others added 4 commits July 16, 2024 11:43
Made the route test just care about replacing regions. Move the nested logic to a different test. If there was a nested nocache tag, it wouldn't be in the view. It would have been converted to a placeholder string.
@jasonvarga jasonvarga merged commit 20089a8 into 5.x Aug 1, 2024
17 checks passed
@jasonvarga jasonvarga deleted the fix/fallback-to-nocache-content-when-cache-middleware-is-missing branch August 1, 2024 21:01
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.

nocache: Always fallback to partial - no placeholder text
2 participants