Skip to content

Blueprint cache is not getting reset after calling setContents on the Blueprint #10124

@eugenf

Description

@eugenf

Bug description

We have a custom addon that adds additional fields to the blueprint via $blueprint->setContents(...).

In Statamic 5 when the setContents is called the cache is not being reset after updating the content when called on existing blueprint that is attached to an entry (e.g. has a parent).

The cache only gets cleared when the blueprint changes from lastBlueprintHandle but in an existing blueprint its the same and the cache is not getting cleared. It was working properly in Statamic 4.

Markup on 2024-05-21 at 13:51:35

Because of that the added fields are always empty when editing an entry.

How to reproduce

  1. Subscribe to EntryBlueprintFound::class event and add a new tab to the Blueprint.
  2. Call $blueprint->setContents($newContents)
  3. The fields will appear on the frontend but when trying to save they will always be empty.
Screenshot 2024-05-21 at 1 58 43 PM

Logs

No response

Environment

Environment
Application Name: Abnormal
Laravel Version: 10.48.10
PHP Version: 8.1.28
Composer Version: 2.7.6
Environment: local
Debug Mode: ENABLED
URL: abnormal.test
Maintenance Mode: OFF

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

Drivers
Broadcasting: log
Cache: statamic
Database: mysql
Logs: stack / single
Mail: ses
Queue: sync
Session: file

Statamic
Addons: 5
Sites: 1
Stache Watcher: Enabled
Static Caching: Disabled
Version: 5.3.0 PRO

Statamic Addons
jacksleight/statamic-bard-mutator: 2.3.1
jacksleight/statamic-bard-texstyle: 3.2.2
pecotamic/sitemap: 1.4.7

Installation

Fresh statamic/statamic site via CLI

Additional details

No response

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions