fix(web): verify composer attachment persistence after flush#1305
fix(web): verify composer attachment persistence after flush#1305UtkarshUsername wants to merge 1 commit intopingdotgg:mainfrom
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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 Tip Migrating from UI to YAML configuration.Use the |
Fixes #1304
What Changed
Fixed composer image attachment persistence verification in
apps/web.The draft store now flushes pending debounced composer draft writes before checking which attachment IDs actually landed in persisted storage. This removes the false warning state where image attachments were marked non-persisted simply because the storage write had not fired yet.
Also added regression coverage for:
Why
The previous logic staged persisted attachments in Zustand state and then immediately checked storage on the next microtask. That check raced the 300ms debounced persistence write and could conclude that attachments were not saved even though the write was only still pending.
This made the orange warning badge show up incorrectly and undermined image draft persistence across refresh/navigation.
Flushing only at the point of attachment verification keeps normal draft persistence debounced for performance, while making the warning badge reflect actual storage failure.
UI Changes
None
Checklist
Note
Fix composer attachment persistence after flushing debounced draft storage
flushComposerDraftStoragein composerDraftStore.ts that wrapscomposerDebouncedStorage.flush()in a try/catch, returning a boolean for success or failure.syncPersistedAttachmentsnow calls this flush before reading persisted attachment IDs from storage; if the flush fails, all attachments are treated as non-persisted.Macroscope summarized 6a25a63.