Conversation
|
That'll work when you have a couple of sites, but once you have more than a few it'll fall apart quickly. We will note that though! |
|
Yeah. Good point. Maybe that's a case for |
Yeah maybe — though for now I'd rather keep things simple and just get it working first. A select box works everywhere. :) |
`localizationData()` calls `origin()->values()` when `hasOrigin()` is true. With a cyclic sites origin map, this enters recursive origin resolution via `values()` and can loop indefinitely while serializing CP asset responses.
When saving a localized asset (e.g. rename/move), hydrate() was filling $data with origin-merged values and meta() was writing that merged set into data.{locale}, turning inherited fields into explicit overrides.
Add localizedDataForPersistence() to only persist explicit localized
data when no mutation occurred. If $data is unchanged from the
hydrated view and removedData is empty, keep the existing explicit
localized bucket as-is.
Show error state and Retry when the asset request fails instead of rendering with null asset and crashing on asset.path.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
|
|
||
| this.activeSite = site; | ||
| this.load(site); | ||
| }, |
There was a problem hiding this comment.
Failed locale load keeps stale editor state
Medium Severity
localizationSelected sets activeSite before load(site), but on load failure the catch block only sets loadError and leaves existing asset data intact. The UI can show prior-site data while activeSite points to a different locale, causing edits to be saved under the wrong site context.



References statamic/ideas#223
Note
High Risk
Touches core asset persistence and meta caching semantics, adds locale-dependent merging/origin logic, and changes CP/API/GraphQL request/response behavior; regressions could impact asset editing/saving across sites.
Overview
Enables localizable asset field metadata (eg. alt text) by introducing locale-aware asset instances (
Asset::locale(),Asset::in()) and persisting meta in a per-sitedata[siteHandle]structure with origin/merge behavior, cycle-safe resolution, and locale-specific meta caching.Updates the CP asset editor and assets fieldtype to pass/select an active site, display a localization selector, track per-locale modified fields, and include
site/_localizedin save requests; adds error/empty-state handling and prevents keyboard navigation shortcuts while typing.Extends CP/API/GraphQL endpoints and resources to accept a
siteparameter and exposelocale, adds an asset-containerlocalizabletoggle in the CP (hidden when multisite is off), and introducesstatamic:assets:migrate-localizableto normalize existing YAML/Eloquent metadata; adds focused tests covering preservation of other locales, non-materialization of inherited values, focal-point non-localization, and cyclic origin maps.Written by Cursor Bugbot for commit 3f03e19. This will update automatically on new commits. Configure here.