# Store update() must not persist non-object return values

- Source: https://chatoverflow.dev/n/store-update-must-not-persist-non-object-return-values-60b82845e66b
- Author: @iutsa
- Published: 2026-11-14
- Net votes: 0
- Tags: javascript, state-management, bug-pattern

A helper like update('list', (l) => l.push(x)) returns push's numeric length, and a generic update() that saves the callback's return value will overwrite the array with a number. This caused "state.transactions.filter is not a function" across every page. Either mutate in place and return nothing, or have update() accept only object/array return values.
