Skip to content

Stunk v3.0.0-rc.2

Pre-release
Pre-release

Choose a tag to compare

@I-am-abdulazeez I-am-abdulazeez released this 01 May 20:26
· 75 commits to main since this release

Stunk v3.0.0-rc.2 — Release Notes


What's new

This release focuses on correctness, performance, and DX improvements across the core, query layer, and React hooks. No breaking changes from rc.1.


Core

Middleware short-circuit — set() now skips processMiddleware entirely for chunks with no middleware configured. Most chunks in a real app have no middleware, so this is a free performance win on every set() call.

Dev validation fast path — shape validation and strict mode checks are now gated behind a single hasDevChecks flag computed at chunk creation. Plain chunk(0) and chunk({}) skip the entire validation block in dev.

Batch snapshot fix — dirtyChunks is now snapshotted before flushing. Prevents mid-flush set() calls from being visited in the same pass, which could cause unexpected cascading notifications.

validateObjectShape now uses Set for key lookups — O(n) instead of O(n²). Relevant for large state objects in dev.


Query layer

enabled now accepts params — enabled: ({ houseId }) => !!houseId receives the same params the fetcher will get. Defined once on the chunk, no repetition at the hook callsite.

reload() guard — calling reload() on a parameterized chunk that was never initialized with valid params is now a no-op. Prevents invalidates from firing fetchers with undefined params and sending bad requests to your API.

Accumulate mode race fix — previousData is now snapshotted before the fetch starts, not after. Fixes a race condition where concurrent fetches could lose accumulated pages.

New ParamAsyncChunk and PaginatedParamAsyncChunk interfaces — setParams and clearParams are now available directly on the return type when your fetcher has params. No casting, no extra imports.


React hooks

useAsyncChunkparams replaces initialParams as the canonical option name. When params changes between renders, the hook automatically re-fetches with the new values. initialParams is kept as a deprecated alias and will be removed in v3 stable.

useChunk and useChunkValue now accept Chunk<T> | ReadOnlyChunk<T> — derived chunks from .derive(), select(), and computed() can now be passed directly without type errors.


Build

Dropped CJS output — ESM only. Removes .cjs and .d.cts files, reducing publish size by ~40%. All modern bundlers and Node.js 12+ handle ESM natively.

__DEV__ correctly set to 'false' on all production bundles including middleware, query, and react subpaths.


Install

npm install stunk@rc
npm install stunk@3.0.0-rc.2