Skip to content

fix: make annotateDirtyNodesWithError return new nodes instead of mutating#14

Open
Av1ralS1ngh wants to merge 1 commit intorawBit-io:mainfrom
Av1ralS1ngh:fix/annotate-dirty-nodes-immutable
Open

fix: make annotateDirtyNodesWithError return new nodes instead of mutating#14
Av1ralS1ngh wants to merge 1 commit intorawBit-io:mainfrom
Av1ralS1ngh:fix/annotate-dirty-nodes-immutable

Conversation

@Av1ralS1ngh
Copy link
Copy Markdown

Problem

annotateDirtyNodesWithError in graphUtils.ts was directly writing node.data.error = true and node.data.extendedError = message onto node objects. This bypasses the immutable update pattern used everywhere else in the codebase (via Immer) and violates React's expectation that state objects are not mutated in place. Both error paths: payload size exceeded and network/timeout failure were affected.

Fix

Convert the function from a void side-effect to a pure mapping function that returns a new array. Each dirty node gets a new object via { ...node, data: { ...node.data, ... } }. Non-dirty nodes are returned as-is (same reference). Both call sites updated to consume the returned array.

…ating

node.data.error and node.data.extendedError were being set directly on
node objects, bypassing the immutable update pattern used elsewhere in
the codebase. Both call sites (payload-limit path and network-error
path) now consume the returned mapped array.
@Av1ralS1ngh Av1ralS1ngh force-pushed the fix/annotate-dirty-nodes-immutable branch from 2fe451f to f3960f0 Compare April 21, 2026 05:13
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