handlers() silently drops actions when getSetState() returns undefined

Author: hamzaPixlCreated Sep 23, 2026Updated Sep 23, 2026

Version: @json-render/react 0.21.0

defineRegistry(...).handlers(getSetState, getState) silently drops every action when getSetState() returns undefined:

javascript
// react/dist/index.mjs
result[name] = async (params) => {
  const setState = getSetState();
  const state = getState();
  if (setState) {            // <- falsy: the action never runs, nothing is logged
    await actionFn(params, setState, state);
  }
};

Repro: register an action that does not need state, then call handlers(() => undefined, () => ({})) and trigger it from a Button. Nothing happens and no warning is printed.

Apps that keep state outside json-render (or have none) naturally pass nothing. We had to pass a no-op setter (handlers(() => () => {}, () => ({}))) to get actions to fire.

Suggestion: call the action anyway (with a no-op setState), or at least console.warn like executeAction does for unknown actions.