I’m working on re-building a game using Aurelia’s State plugin. I feel I have come across an oddity. When subscribing to State, you can use Pluck
to reach into the state and read something directly, but it seems that actions always get the global state.
If I wanted to add a student to a school, and my state is organized like
[District].[ZipCode].[School].[Grade].[student]
my addStudent action would need to transverse the entire path, even if the component I’m working in is already limited to the school. From https://aurelia.io/#two-way-binding-and-state-management a model
is used to contain the new person, and is updated using return Object.assign({}, state, model)
, but this is only useful if the new person is at the base of the State.
Is there (should there?) be a way for an action to only receive and affect a specific portion of the state? Perhaps a
store.registerActionAtPath(stringId, functionCB, pluckPath)