Skip to content

Using {{ nocache }} around a form renders it once, but not on subsequent visits #10890

@aaronbushnell

Description

@aaronbushnell

Bug description

We have a Statamic 5.26.0 site that renders a form using code similar to the docs because we have enabled full static caching:

{{ nocache }}
    {{ form:create formset="contact" }}
        ...
    {{ /form:create }}
{{ /nocache }}

On page load the form is correctly AJAX'd in using the {{ nocache }} functionality.

However, when I bump the version to 5.27.0 the form renders the first time, but after subsequent visits the form never loads again.

I'm not certain if it's related but the {{ nocache }} JS was at the end of the </body> tag in 5.26.0, but moved to the <head> in 5.27.0.

How to reproduce

  • Create a form
  • Add the form to an Antlers template using the recommended caching setup
  • Turn on full page static caching
  • Load the page multiple times

Logs

No response

Environment

Environment
Application Name: Statamic Starter
Laravel Version: 11.26.0
PHP Version: 8.3.0
Composer Version: 2.8.0
Environment: production
Debug Mode: OFF
URL: [REDACTED]
Maintenance Mode: OFF
Timezone: America/Indiana/Indianapolis
Locale: en

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

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

Statamic
Addons: 9
Sites: 1
Stache Watcher: Disabled (auto)
Static Caching: full
Version: 5.26.0 PRO

Statamic Addons
mitydigital/statamic-scheduled-cache-invalidator: 2.1.0
rias/statamic-redirect: 3.8.1
statamic/seo-pro: 6.1.2
trendyminds/guide: dev-main
trendyminds/link: dev-main
trendyminds/nerf: 1.2.0
trendyminds/orbit-statamic: 2.0.0
trendyminds/statamic-palette: 1.2.1
trendyminds/tip: 1.0.0

Installation

Other (please explain)

Additional details

Uses a Statamic starter repo we developed in-house

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions