Skip to content

Full-measure caching does not work with declarative shadow root elements inside nocache tags #12685

@benStre

Description

@benStre

Bug description

I am using an HTML <template shadowrootmode="open"> element to create a declarative shadow root element, wrapped in a {{ nocache }} tag.

When using static caching with the half strategy, this works perfectly fine, but when using full caching, the shadow root is not correctly rendered.

The reason for this is that the generated JS code for the nocache tag inserts the HTML using .outerHTML, which does not correctly handle declarative shadow roots.
I suggest using setHTMLUnsafe instead to support shadow roots for this scenario.

How to reproduce

  • STATAMIC_STATIC_CACHING_STRATEGY set to full
  • {{ nocache }}
        <div>
          <template shadowrootmode="open">...</template>
        </div>
    {{ /nocache }}

This bug occurs in https://github.com/emplify-software/statamic-cookie-dialog (see emplify-software/statamic-cookie-dialog#8)

Logs

Environment

Environment
Application Name: Statamic
Laravel Version: 12.33.0
PHP Version: 8.4.13
Composer Version: 2.8.11
Environment: local
Debug Mode: ENABLED
Maintenance Mode: OFF
Timezone: UTC
Locale: de

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

Drivers
Broadcasting: log
Cache: file
Database: sqlite
Logs: stack / single
Mail: log
Queue: sync
Session: file

Storage
public/storage: NOT LINKED

Statamic
Addons: 1
Sites: 1
Stache Watcher: Enabled (auto)
Static Caching: full
Version: 5.66.0 PRO

Statamic Addons
emplify-software/statamic-cookie-dialog: 2.0.2

Installation

Fresh statamic/statamic site via CLI

Additional details

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions