-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Experiment: Storing the data model in a Context #1175
Closed
Labels
area/data-storage
fe-v4
Issues to be solved before v4 goes gold
feature-complete
Features needed for parity with Altinn 2 (target: June 2023)
quality/debt
Comments
This was referenced May 25, 2023
21 tasks
This was referenced Jun 5, 2023
19 tasks
olemartinorg
added a commit
that referenced
this issue
Aug 29, 2023
This was referenced Sep 1, 2023
Closed
This was referenced Sep 25, 2023
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area/data-storage
fe-v4
Issues to be solved before v4 goes gold
feature-complete
Features needed for parity with Altinn 2 (target: June 2023)
quality/debt
This issue describes an approach to restructure our data model (in-memory) storage for app-frontend, extracted from #345.
Background
Currently, we're using Redux and some complex sagas to manipulate the data model, and we're storing everything in dot-notation internally. We do this because Redux has trouble with deeper stuctures, and I trust that former developers has gone down that route and landed on Redux and dot-notation for a reason. It even says this is a good thing in our docs.
Right now, this structure has multiple downsides, mainly:
index
property on our repeating group state, without ever letting the server know that a new row was added. Changing this, as proposed in Validation trigger on group should re-validate on delete + new row #555, would be a breaking change.useDelayedSaveState
hook that debounces input from the user so that we wait a while before storing the change in Redux (and subsequently calling the server). In hindsight, our data model storage should more intelligently handle multiple changes in rapid succession, and wait to save the data on the server when our state has stabilized. Multiple/rapid updates to the data model currently works, but has caused multiple problems (see one of the outstanding issues in List component: remaining issues #925 and the bug reported in Timing issue regarding updating the data model (Stateless) #989).Proposed solution
Instead of swapping out the entire state manager (as it is sort-of proposed in #345), this issue suggests creating a React Context for the data model storage, and provide tools to manipulate and fetch data in that context. This means we could still have reducers and complex tasks that would happen as the data model updates, but by implementing this ourselves we get better creative control over how this is handled.
A few requirements for this context should be:
useDelayedSavedState
altogetherThe text was updated successfully, but these errors were encountered: