Repository navigation
Minor Changes
-
5a68cd0: Fix the effect lifecycle under StrictMode and
<Activity>, add anAbortSignalto effects, and publish as ESM only.- Fix: running effects (including initial effects) are resumed after StrictMode's simulated unmount/remount and when an
<Activity>boundary becomes visible again. Previously they were stopped and never restarted. Resumed effects receive the latest state. - Fix: an effect stopped via
exec.stop(entity)in the same reducer call that queued it no longer starts. - Fix: effects queued by a synchronous dispatch from inside an effect are no longer dropped under StrictMode.
dispatchpassed to effect implementations now accepts string events, like the hook'sdispatch.EffectEntity['status']is now'idle' | 'started' | 'stopped'(was a non-exported numeric enum).DispatchandEntityStatustypes are exported.- Lazy initialization uses
useReducer'sinitargument instead of reading a ref during render (React Compiler friendly). - Effect implementations receive a 4th argument,
{ signal }: anAbortSignalaborted when the effect stops. Effects may beasync. - Effects-map implementations are looked up when an effect starts (or resumes), so they see the latest props.
exec.stop(entity)acceptsundefined.- Types: string events are only accepted for events without required payload;
exec/dispatchin the initial state getter are fully typed. - Packaging: the package is ESM-only. CommonJS consumers can
require()it on Node.js 20.19+ and 22.12+, whichengines.nodenow requires.
- Fix: running effects (including initial effects) are resumed after StrictMode's simulated unmount/remount and when an
Patch Changes
- 608692b: The hook passes the React Compiler lint rules (
eslint-plugin-react-hooksrecommended config). The effects map is now read only from effects, never during render.