🐛 Fix: Disable newly created event from being editing during optimistic render cycle #206
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
While you already proposed a solution for this issue here, preventing the user from initially DnD or editing the event did not seem very UI/UX friendly to me.
I thought about and researched other solutions, the best solution to handle this issue is to implement Transactional State Management to handle this type of transient data, but this implementation itself is split into many strategies.
Each strategy has its own pros and cons, but they all share 1 same con and that is they are difficult to implement and adds lots of overhead.
The 2nd best approach was to simply display a loading indication when the event is initially being created, removing the optimistic approach entirely.
But this would:
So the best thing we can do here is to implement your proposed solution which is disabling edits during its optimistic status.
I tried my best to make it UI/UX friendly by displaying a different cursor and a distinct background color to indicate we are doing some loading to the user.
I included all this extra context as logs for future reference and your own consideration.
Demo
Peek.2024-12-28.16-31.webm