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

@nocache partial missing vars when static caching disabled. #11144

Open
stuartcusackie opened this issue Nov 19, 2024 · 2 comments
Open

@nocache partial missing vars when static caching disabled. #11144

stuartcusackie opened this issue Nov 19, 2024 · 2 comments

Comments

@stuartcusackie
Copy link

stuartcusackie commented Nov 19, 2024

Bug description

A blade @nocache problem seems to have been created in a recent release. It wasn't a problem before.

I need access to the $page variable in one of my no-cached partials, e.g.:

// layout.blade.php
@nocache('partials/nocache-example')

// partials/nocache-example.blade.php
<div>{{ $page->title }}</div>
  • If static caching is enabled then $page->title works as expected.
  • If static caching is disabled then the $page variable does not exist.

Why am I disabling static caching? It is always disabled on my local environment and enabled on the server.

How to reproduce

Try to access $page in a @nocache partial when static caching is disabled.

Logs

No response

Environment

Environment
Laravel Version: 11.30.0
PHP Version: 8.3.13
Composer Version: 2.7.4
Environment: local
Debug Mode: ENABLED
Maintenance Mode: OFF
Timezone: Europe/Dublin
Locale: en

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: database
Database: mysql
Logs: single
Mail: smtp
Queue: database
Session: file

Livewire
Livewire: v3.5.12

Statamic
Addons: 6
Sites: 1
Stache Watcher: Enabled
Static Caching: null
Version: 5.38.0 PRO

Statamic Addons
jonassiewertsen/statamic-live-search: 2.1.1
jonassiewertsen/statamic-livewire: 3.8.1
rias/statamic-redirect: 3.8.1
spatie/statamic-responsive-images: 5.2.1
statamic/seo-pro: 6.3.0
stuartcusackie/statamic-cache-requester: 1.2.7

Installation

Fresh statamic/statamic site via CLI

Additional details

No response

@stuartcusackie stuartcusackie changed the title @nocache directive doesn't work properly when static caching disabled. @nocache partial missing vars when static caching disabled. Nov 19, 2024
@stuartcusackie
Copy link
Author

Maybe hold off on investigating this one. It seems to affect only certain projects of mine, it could be something else.

I'll leave it open in case somebody else has the same issue.

@duncanmcclean
Copy link
Member

Okay! Let us know if you (or anyone else) is able to reproduce this issue on a fresh Statamic site and we can take a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants