statamic / cms

The core Laravel CMS Composer package
https://statamic.com
Other
4.09k stars 534 forks source link

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

Open stuartcusackie opened 3 days ago

stuartcusackie commented 3 days ago

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>

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