Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new sync module providing lightweight synchronous reactive primitives (Value, Computed) intended to integrate with React’s useSyncExternalStore, along with tests and documentation, and updates the Jest toolchain.
Changes:
- Introduces
src/sync.tswithValue,Computed, andval/comphelpers. - Exposes the new module via
src/index.tsand documents it inREADME.md. - Adds comprehensive Jest tests for the new primitives and upgrades Jest/@types/jest dependencies (with corresponding lockfile updates).
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| yarn.lock | Updates dependency lockfile due to Jest/tooling upgrades. |
| src/sync.ts | Adds reactive sync primitives and React external-store-compatible interfaces. |
| src/index.ts | Re-exports the new sync module from the package entrypoint. |
| src/tests/sync.spec.ts | Adds test coverage for Value/Computed behavior, caching, and disposal. |
| package.json | Upgrades Jest + typings (toolchain impact). |
| README.md | Documents the new Value/Computed primitives and factories. |
Comments suppressed due to low confidence (1)
package.json:54
- Jest was bumped to v30 but
ts-jestis still on the v29 line, while the test runner is configured to transform TS viats-jest(jest.config.js). In yarn.lock,ts-jest@29.3.0pullsjest-util@^29.0.0, which is a strong indicator it targets Jest 29 APIs. Please align versions (upgradets-jestto a Jest-30-compatible release, or keep Jest on v29) to avoid runtime/transform incompatibilities in CI.
"@types/jest": "^30.0.0",
"benchmark": "^2.1.4",
"husky": "^8.0.0",
"jest": "^30.3.0",
"prettier": "^3.0.0",
"pretty-quick": "^3.1.1",
"rimraf": "^3.0.2",
"ts-jest": "^29.1.2",
"tslib": "^2.6.2",
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| this.value = value; | ||
| } | ||
|
|
There was a problem hiding this comment.
There is trailing whitespace after the closing brace; this can cause unnecessary diffs and may fail stricter linters/formatters. Please remove the trailing space.
| } | ||
|
|
||
| export const val = <V>(initial: V): Value<V> => new Value(initial); | ||
| export const comp = <V extends unknown[], N>(deps: WrapListInSyncDep<V>, compute: (args: V) => N): Computed<N, V> => |
There was a problem hiding this comment.
The public API currently passes dependency snapshots as a single array/tuple argument (compute(args: V)), but the PR description example uses a single-value callback (comp([view], (view) => ...)). As implemented, that example would receive [view] (an array) rather than view. Either update the API to call compute(...snapshots) (and type it as (...args: V) => N) or update the docs/examples to reflect the tuple-argument shape (([view]) => ...).
|
🎉 This PR is included in version 2.6.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Introduces very light-weight Signal-like reactive primitives that work well with React.js external sync store.