You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Local rx._x.client_state setter raises ReferenceError when the setter is on a sibling component #7426
A local client state (rx._x.client_state(..., global_ref=False)) does not work when the setter is on a sibling component. A click raises a ReferenceError, and the reader keeps its default value.
#local-reader keeps local-initial. The browser reports:
Uncaught ReferenceError: setIcgswkgu is not defined
Cause
The memoize plugin compiles the button into its own memo component. Its onClick calls the bare setter name (setIcgswkgu(...)). The useState hook that defines the setter is only in the page component, where the reader is. So the setter is not in scope in the button's component.
ClientStateVar.set_value does not attach the hooks to a local setter on purpose. A private copy of the state would update a value that no reader sees. So a local setter only works in the same component scope as its useState. Memoization splits sibling components into separate scopes, so this case does not work.
The bug occurs on main (7970e91f0). It is not related to #7407.
Fixed on main by #6936. Each memoized component now calls its own useClientState hook, and the page scope maps them to one store entry. The setter is in scope where the click calls it, and the reader updates.
Activity
linear-code commentedon Oct 5, 2026
ENG-13067
FarhanAliRaza commentedon Nov 4, 2026
Fixed on main by #6936. Each memoized component now calls its own
useClientStatehook, and the page scope maps them to one store entry. The setter is in scope where the click calls it, and the reader updates.