Replies: 3 comments 2 replies
-
Update: After talking about this with @timengel, we think it would be an easier and more consistent solution to keep doing the changes in the backend right away, therefore instantly deleting/unstacking a note for all users, but also keeping a local action queue in order to undo those changes using the backend within the 5s period. |
Beta Was this translation helpful? Give feedback.
-
How about this approach (for the example of deleting notes):
Since this array of identifiers doesn't change with state updates of our notes, we can always use it to filter/map the notes. |
Beta Was this translation helpful? Give feedback.
-
Is this discussion still current? @Schwehn42 @brandstetterm |
Beta Was this translation helpful? Give feedback.
-
Hi all, regarding #2350, I'm currently contemplating on how to approach this problem.
Current situation:
Action.DeleteNote
just sends the API callAction.DeletedNote
is invoked via websocketsome thoughts about the flow:
On delete:
new
Action.LocalDeleteNote
:Action.DeletedNote
Action.UndoDelete
:Note[]
to something more complex to keep track of local deletions/unstackings, e.g.{notes: Note[]; actionQueue: {note: Note, action: "delete"|"unstack"}[]}
Action.DeletedNote
:actionQueue
in state) remove that entry and return stateOn unstack:
Some more points:
Action.LocalDeleteNote
might not be necessary, maybe using the currentAction.DeleteNote
will be enough but I'm not certain, when drafting I wanted to have a clear line between the functionality of the Actions though.NoteState
in order to keep the information required, refactors in the whole project will be required, i.e. wherever notes are used,notesState.filter(...)
would becomenotesState.notes.filter(...)
.As you can see, this problem is a lot more complex that I intitially anticipated, so I would be grateful if you had any ideas or pointers how to improve my approach :)
Beta Was this translation helpful? Give feedback.
All reactions