Skip to content

Conversation

@iboughtbed
Copy link
Collaborator

@iboughtbed iboughtbed commented Sep 8, 2025

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.

  • Bug Fixes
    • Added queue to context with enqueueItem and processNextInQueue actions.
    • START is now accepted in askRecurringScope, askNotifyAttendee, and mutate.
    • Introduced checkQueue state to drain the queue after mutate/rollback or when no item is present.
    • clear now resets the queue; added clearQueueOptimisticActions to clean leftover optimistic actions.

@iboughtbed iboughtbed self-assigned this Sep 8, 2025
@vercel
Copy link

vercel bot commented Sep 8, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
analog Ready Ready Preview Comment Sep 8, 2025 4:08pm

@coderabbitai
Copy link

coderabbitai bot commented Sep 8, 2025

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a 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" },
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Sep 9, 2025

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: &quot;clear&quot;`) 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: &quot;removeOptimisticAction&quot;,
-        always: { target: &quot;idle&quot;, actions: &quot;clear&quot; },
+        always: { target: &quot;checkQueue&quot;, actions: &quot;clear&quot; },
       },
 
</file context>
Fix with Cubic

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.

2 participants