statamic / cms

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

Augmentation cache does not respect site/locale #10428

Closed mvar closed 1 week ago

mvar commented 2 weeks ago

Bug description

Relation is not loaded if it has value in master site.

In my case entries has relation to "country". There are two sites: master and en. When loading data for "en" relations that has value assigned in "master" site will not be loaded.

Disabling cache in Entries class (reverting to Statamic 4 code) solves the problem.

Here cache key is generated only by $values

https://github.com/statamic/cms/blob/v5.13.0/src/Fieldtypes/Entries.php#L352

but actual data is queried by site

https://github.com/statamic/cms/blob/v5.13.0/src/Fieldtypes/Entries.php#L332

How to reproduce

Will provide later.

Logs

No response

Environment

Laravel Version: 10.48.16
PHP Version: 8.2.18
Composer Version: 2.7.4
Environment: local
Debug Mode: ENABLED

Statamic
Addons: 5
Sites: 3 (English, Norwegian, Master)
Stache Watcher: Disabled
Static Caching: Disabled
Version: 5.12.0 PRO

Statamic Addons
mitydigital/sitemapamic: 3.0.2
statamic-rad-pack/runway: 7.5.3
statamic/collaboration: 1.0.0
statamic/eloquent-driver: 4.8.1
takepart-media/statamic-oreos: 1.3.0

Installation

Other (please explain)

Additional details

Problem occurred after Statamic upgrade from version 4 to version 5.

jasonvarga commented 2 weeks ago

Good find. We can probably add the locale into the blink key.