Skip to content

SET_FUNCTIONS in reducer mutates state in-place, toolbar buttons unreliable after server actions #335

@avinxshKD

Description

@avinxshKD

every other case that touches a specific graph uses .map() to produce new array + object refs. SET_FUNCTIONS doesn't. It does { ...state }, then writes directly into newState.graphs[curGraphIndex].built = ... etc. Shallow copy means graphs array and the graph object inside it keep the same references. React can and does skip re-renders on this.

Practical effect: after build(), run(), debug(), clear(), stop(), destroy() all dispatch SET_FUNCTIONS via 6-server.js - serverAction(). The toolbar in toolbarList.js reads these flags to set the active prop. With stale refs, buttons don't update correctly ,Build stays greyed, Run stays enabled, etc.

Fix needs proper .map() rewrite in reducer.js + a regression pass across all 6 server action flows to verify button states actually update. Not a one-liner because the payload shape also needs checking against initialGraphState defaults.

affected are reducer.js (SET_FUNCTIONS case), 6-server.js, src/toolbarActions/toolbarList.js

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions