You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ecs-persistence: apply a snapshot's values onto an existing entity (a persisted setting on a startup entity) #249
Spawning from a snapshot with match keeps the world's values for what it matches, and nothing applies a snapshot's values onto an existing entity. So an entity the app's own startup system creates (and persistence should only update) can't be a persisted setting.
Case (mecs, @adobe/ecs-persistence 0.1.0)
The camera's orbit (target, distance, angles) is a component of an entity that spawnOrbitView makes at startup. We want it saved as a setting (inSettings, kept on the machine, shared by tabs). Restoring with spawn({ world, snapshot, entities: false, match }) either leaves the startup value (match keeps the world's) or, without match, spawns a second view.
Requested
An option to apply the snapshot's values onto the matched entity: spawn({ ..., match, update: true }), or a separate apply({ world, snapshot, match }), writing the snapshot's persisted components onto the entity that match finds, and leaving other components as they are.
Notes
Settings already work for resources; this is the component half.
Addressed in #250 (Adobe-Firefly/ecs#9) as an option on spawn rather than a separate apply, so the entity map and reference rewriting stay one pass: spawn({ world, snapshot, match, update: true }) writes a matched row's saved components onto the entity it matches, as commands.add would, leaving its other components. Core commands.spawnTables takes the same update. The settings chapter of the persistence guide restores a startup entity's component this way.
Activity
krisnye commentedon Nov 1, 2026
Addressed in #250 (Adobe-Firefly/ecs#9) as an option on
spawnrather than a separateapply, so the entity map and reference rewriting stay one pass:spawn({ world, snapshot, match, update: true })writes a matched row's saved components onto the entity it matches, ascommands.addwould, leaving its other components. Corecommands.spawnTablestakes the sameupdate. The settings chapter of the persistence guide restores a startup entity's component this way.