Skip to content

fix: Fix stale watched action data overwriting proposal actions after remove/add - #1306

Closed
milosh86 wants to merge 1 commit into
mainfrom
fix-actions-state-management
Closed

fix: Fix stale watched action data overwriting proposal actions after remove/add#1306
milosh86 wants to merge 1 commit into
mainfrom
fix-actions-state-management

Conversation

@milosh86

@milosh86 milosh86 commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Description

useFieldArray's fields update synchronously inside remove()/append(), but useWatch only catches up a render later. Comparing array length alone isn't enough to detect that lag: deleting one action and adding a different one leaves the array length unchanged, so a stale watchedAction describing the just-deleted action can slip through — overwriting the new action's type and silently mounting the wrong view populated with the previous action's data.

This replaces the length-based staleness check with a fieldId comparison (unique per action instance), which catches the lag even when the length coincidentally matches again.

Type of Change

  • Major: Breaking change (change that would cause existing functionality to not work as expected)
  • Minor: Feature (non-breaking change which adds new functionality)
  • Patch: Enhancement (non-breaking change to an existing feature)
  • Patch: Bug fix (non-breaking change which fixes an issue)

Developer Checklist:

  • Manually smoke tested the functionality in a preview or locally
  • Confirmed there are no new warnings or errors in the browser console
  • (For User Stories only) Double-checked that all Acceptance Criteria are satisfied
  • Confirmed there are no new warnings on automated tests
  • Merged and published any dependent changes in downstream modules
  • Selected the correct base branch
  • Commented the code in hard-to-understand areas
  • Followed the code style guidelines of this project
  • Reviewed that the Files Changed in Github's UI reflect my intended changes
  • Confirmed the pipeline checks are not failing

Review Checklist:

  • (For User Stories only) Tested in a preview or locally that all Acceptance Criteria are satisfied
  • Confirmed that changes follow the code style guidelines of this project

… remove/add

Signed-off-by: Milos Dzepina <milos@aragon.org>
@milosh86
milosh86 marked this pull request as ready for review August 7, 2026 08:50
@milosh86
milosh86 requested a review from a team as a code owner August 7, 2026 08:50
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

🚀 Preview Deployment: View Here

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

E2E results (preview)

Smoke

Base URL https://app-next-4qln1pg81-aragon-app.vercel.app
Suite smoke
Playwright result ✅ passed
Summary 82 passed
HTML report View report
GitHub job ✅ completed

View run #4884

@milosh86 milosh86 closed this Aug 7, 2026
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.

1 participant