-
-
Notifications
You must be signed in to change notification settings - Fork 191
fix: introduce a queue into update state machine #367
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
base: main
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 issue found across 1 file
React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.
| rollback: { | ||
| entry: "removeOptimisticAction", | ||
| always: { target: "idle", actions: "clear" }, | ||
| always: { target: "checkQueue", actions: "clear" }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rollback state clears the entire update queue (actions: "clear") if a single update fails, but it does not clean up the optimistic UI changes for the discarded queued items. The clearQueueOptimisticActions function was added to handle this cleanup, but it is never called, leading to a leaked UI state where the application shows updates that have been silently dropped.
Prompt for AI agents
Address the following comment on apps/web/src/components/calendar/flows/update-event/update-queue.ts at line 182:
<comment>The `rollback` state clears the entire update queue (`actions: "clear"`) if a single update fails, but it does not clean up the optimistic UI changes for the discarded queued items. The `clearQueueOptimisticActions` function was added to handle this cleanup, but it is never called, leading to a leaked UI state where the application shows updates that have been silently dropped.</comment>
<file context>
@@ -137,32 +153,44 @@ export function createUpdateQueueMachine({
rollback: {
entry: "removeOptimisticAction",
- always: { target: "idle", actions: "clear" },
+ always: { target: "checkQueue", actions: "clear" },
},
</file context>
Summary by cubic
Added a queue to the update-event state machine to serialize updates and capture START events fired during prompts or an in-flight mutation. This prevents dropped updates and race conditions during rapid edits.