48107 frontend [ tasks ] fix forms state#267
Open
aicarma-artyom-maslov wants to merge 3 commits into
Open
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit c07282f. Configure here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

Note
Medium Risk
Touches task completion/revert flows and localStorage draft persistence; incorrect flush/cancel timing could still lose or resurrect draft data, but changes are localized with new tests.
Overview
Fixes task form draft behavior so in-progress output edits are not lost or incorrectly re-saved when the server refreshes task data, the card unmounts, or the user completes or reverts a task.
TaskCard now uses a flushable debounce for localStorage drafts: pending saves are flushed before output is reloaded from the server or on unmount, and cancelled on complete/revert so stale drafts are not written back. Output field keys are scoped with
task.idto avoid collisions when switching tasks. On revert, the action includesclearOutputTaskIdsfor the current task and its revert chain.localStorage helpers gain bulk draft removal and drop the storage key when no drafts remain.
ExtraFieldFile refreshes the displayed attachment list when props change (unless an upload is in progress) and merges new uploads against the latest file state via a ref.
Tests cover debounce flush/cancel, storage cleanup, draft persistence edge cases, and file-field sync during upload.
Reviewed by Cursor Bugbot for commit 76294ad. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Fix task form state to prevent draft loss and stale data on revert or complete
throttle-debounce's debounce with a newcreateFlushableDebounceutility that supports explicitflushandcancel, so pending draft saves can be controlled at key moments.TaskCardflushes pending saves when task output data changes or on unmount, and cancels pending saves before completing or reverting a task.setTaskRevertednow acceptsclearOutputTaskIdsto remove drafts for the current task and related revert tasks in a single localStorage operation.ExtraFieldFileuses a ref to track files-in-flight so uploads and deletions always operate on the latest file list even if props change mid-upload.saveOutputsToStoragenow removes the localStorage key entirely when no drafts remain instead of storing an empty array.Macroscope summarized 76294ad.