Skip to content
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

🐛 fix: keep new event on grid during save #197

Conversation

that-one-arab
Copy link
Contributor

@that-one-arab that-one-arab commented Dec 22, 2024

Fixes this

Uses an optimistic UI rendering approach.

I believe Optimistic UI approach is the simplest and easiest solution under the current circumstances.

There are a couple of edge cases that needs to be handled that I believed were out of scope of this issue, but should be tackled in the future; during the timespan where the optimistically generated event is created and the HTTP request returns a response from the server:

  • The event cannot be drag and dropped
  • The event cannot be deleted (would delete a local version but the API would re-generate a new one after the HTTP request returns a response)

We can tackle these separately

@that-one-arab that-one-arab changed the title Bug keep new event on grid during save 🐛 fix: keep new event on grid during save Dec 22, 2024
@that-one-arab that-one-arab force-pushed the bug_keep_new_event_on_grid_during_save branch from 4e85f7f to 2105935 Compare December 22, 2024 03:40
…Event()

the event schema is meant to more closely represent the data model. optimistic shouldn't be part of the data model
for consistency with other boolean naming
without upgrading the target, TypeScript is unable to iterate through a generator without the --downlevelIteration flag or a --target of es2015 or higher. This issue arises because the yield* expression is used to delegate to another generator function, and TypeScript needs to be able to iterate through the generator.
@tyler-dane tyler-dane self-requested a review December 23, 2024 13:36
Copy link
Contributor

@tyler-dane tyler-dane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm gonna do a little more cleanup and QA, but this is in pretty good shape.

Thanks, @that-one-arab!

@that-one-arab
Copy link
Contributor Author

I'm gonna do a little more cleanup and QA, but this is in pretty good shape.

Thanks, @that-one-arab!

Thanks @tyler-dane !

I'll keep an eye on the cleanups you're doing, learn new things in the process.

Removed TODO comment. We're probably better off sticking with passing ids to conform to the codebase
@that-one-arab that-one-arab force-pushed the bug_keep_new_event_on_grid_during_save branch from 030b763 to 6a57e09 Compare December 24, 2024 03:57
@that-one-arab
Copy link
Contributor Author

@tyler-dane I added additional commits that continues from where you left off

instead, we're deriving this value by the id itself. if it's prefixed with "optimistic", we know it's an optimistic event.

by removing this from the schema, we prevent ui fields from creeping into our database and cut down on the parsing we have to do in the redux slice/sagas
previously we swapped the id key, but we also have to swap the nested id value in order to completely replace the optimistic event with the actual event
@tyler-dane
Copy link
Contributor

Just made a few more tweaks, but we can consider this done! I'm going to hold off on merging until after I've had the chance to deploy it to prod.

@tyler-dane
Copy link
Contributor

Alright, deployed and tested. Congrats on your first PR! 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Keep new event on grid during save
2 participants