You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using @nocahe blade directive for excluding auth dropdown. This give a NOCACHE_PLACEHOLDER text in non statamic routes. In the comments of issue #6682 the tip is to add statamic.web middleware to the custom route.
With that middleware the nocache placeholder is gone, but then the auth in other section of the page get cached. This is a problem with route that display user data.
User data on the frontend are laravel eloquent users.
I've ran into this one recently too. It happened to me when I had the {{ nocache }} tag present and had a form on the page but the static caching middleware wasn't present.
After debugging and digging around I maybe stumbled on a solution. The @nocache tags push a Statamic\StaticCaching\NoCache\ViewRegion to regions. The ViewRegion extends Statamic\StaticCaching\NoCache\Region and that has a method placeholder. If I add a method placeholder to ViewRegion that returns the original view with context the nocache tags works outside of statamic routes.
Bug description
I'm using
@nocahe
blade directive for excluding auth dropdown. This give aNOCACHE_PLACEHOLDER
text in non statamic routes. In the comments of issue #6682 the tip is to addstatamic.web
middleware to the custom route.With that middleware the nocache placeholder is gone, but then the auth in other section of the page get cached. This is a problem with route that display user data.
User data on the frontend are laravel eloquent users.
How to reproduce
Example repo: https://github.com/jhhazelaar/laravel-statamic-nocache-placeholder
Set
STATAMIC_STATIC_CACHING_STRATEGY
tohalf
.Register two users in the application. Login and go to dashboard. Login second user and go to dashboard. See username of first user in dashboard.
Logs
No response
Environment
Installation
Existing Laravel app
Antlers Parser
None
Additional details
No response
The text was updated successfully, but these errors were encountered: