Replies: 1 comment
-
ImmutableDictionary doesn't copy all of its state. It creates new state with the changes, and for all unchanged data it simply references parts of the original state. If you want to have each tab only notified when its own entry updates, rather than every time the ImmutableArray is replaced, inject IStateSelection<TState, TElement> instead of IState |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Inspired by Vuex ORM before migrating to Blazor and Fluxor. General question - is this a case for Fluxor or better to do it in another way?
There is
DocumentState
(like table in database), where we haveEntities
immutable dictionary ofId -> DocumentStateModel
:DocumentStateModel represents opened tab in some TabControlComponent at UI. User can switch between tabs (documents).
Each DocumentStateModel has an immutable dictionary of
FieldId -> DocumentDataItem
(EAV):User can change any value of data items by text fields.
The problem is: when we try to dispatch some action like...
...there is a need to copy entire
DocumentState
with all loaded documents and all data inside it.Might be nice to have dedicated
DocumentDataItemState
with ownEntities
collection? But anyway we need to copy large data items collection of many documents just to set updated value for single field (while typing, for example). Is this completely normal behavior?State must react for changes immediately (as there can be linked fields on different levels of nested layout, which looking for changed values to do some near-realtime calculations).
There can be two documents, opened side by side in different tabs. So state with multiple documents seems a good place to keep data. But I feel it can be costly for machine resources while dispatching frequently actions...
Beta Was this translation helpful? Give feedback.
All reactions