Skip to content

fix(APP-593): Fix crash when removing early items from watched field arrays#1073

Merged
milosh86 merged 4 commits intomainfrom
app-593-app-crashes-when-removing-early-actions-from-json-upload
Apr 2, 2026
Merged

fix(APP-593): Fix crash when removing early items from watched field arrays#1073
milosh86 merged 4 commits intomainfrom
app-593-app-crashes-when-removing-early-actions-from-json-upload

Conversation

@milosh86
Copy link
Copy Markdown
Contributor

@milosh86 milosh86 commented Apr 2, 2026

Description

Fixes a crash that occurred when removing items from the middle of an uploaded JSON action list (or similar watched field arrays). The root cause was a stale-data race between useWatch and useFieldArray: immediately after remove(), useWatch still returns the old (longer) array while fields has already been updated, causing the merge map to override fieldArray items with wrong items from watched list, while id/key of items is kept the same.

Fix: Before merging fields and watchFieldArray, check that their lengths match. If they don't (stale frame), skip the watch data for that render and preserve the field.id from the source-of-truth useFieldArray. Applied to:

  • CreateProposalFormActions (JSON upload actions)
  • GovernanceStageBodiesField (governance stage bodies)
  • TokenSetupMembershipCreateToken (token member list)

Resolves APP-593.

Type of Change

  • 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

milosh86 added 2 commits April 1, 2026 16:40
Signed-off-by: Milos Dzepina <milos@aragon.org>
Signed-off-by: Milos Dzepina <milos@aragon.org>
@linear
Copy link
Copy Markdown

linear bot commented Apr 2, 2026

@milosh86 milosh86 marked this pull request as ready for review April 2, 2026 08:10
@milosh86 milosh86 requested a review from a team as a code owner April 2, 2026 08:10
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 2, 2026

🚀 Preview Deployment: View Here

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 2, 2026

E2E Smoke Results

Base URL https://app-next-8d30gyrtv-aragon-app.vercel.app
Suite smoke
Playwright result ✅ passed
Summary 43 passed, 1 skipped
GitHub job ✅ completed
Run #3975

thekidnamedkd
thekidnamedkd previously approved these changes Apr 2, 2026
Copy link
Copy Markdown
Contributor

@thekidnamedkd thekidnamedkd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!✨ I would maybe just keep the var names the same as much as possible and not past tense where possible

@milosh86
Copy link
Copy Markdown
Contributor Author

milosh86 commented Apr 2, 2026

Looks good!✨ I would maybe just keep the var names the same as much as possible and not past tense where possible

yeah, makes sense, I'll update

Signed-off-by: Milos Dzepina <milos@aragon.org>
Copy link
Copy Markdown
Contributor

@thekidnamedkd thekidnamedkd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM ✨

@milosh86 milosh86 merged commit cd6d7ef into main Apr 2, 2026
17 checks passed
@milosh86 milosh86 deleted the app-593-app-crashes-when-removing-early-actions-from-json-upload branch April 2, 2026 11:13
@arabot-1 arabot-1 mentioned this pull request Apr 2, 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.

2 participants