feat: add the Phase 2 React adapter with Turborepo - #2
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the Phase 2 framework adapter tasks in a separate
@wthw7/effect-query-reactworkspace package. React stays out of the core manifest.createQueryHooks(runtime)with typed runtime requirements,useQuery(definition, ...args), anduseMutation(definition). Query fibers cancel on key change/unmount and handle StrictMode replay; mutation pending state covers concurrent calls and coreonSuccesshandlers.0.3.0-beta.0. The release workflow packs workspace dependencies into registry versions and publishes core before the adapter.API and cache semantics
Query errors are Effect
Cause<E | KeyHashError>values. Mutations resolvePromise<Exit<A, E | E2>>, preserving failure, defect, and interruption outcomes. The application owns runtime disposal.Hooks expose fetch snapshots, not live cache subscriptions: background revalidation, manual writes, and invalidation do not automatically rerender mounted consumers. Core winner/joiner cancellation remains unchanged, including interruption of surviving joiners when the winning observer unmounts. These boundaries are documented in the spec and adapter README.
Publishing is still pending and is not performed by this PR. Configure npm Trusted Publishing for the new adapter before releasing; the Phase 2 publish gate remains open.
Test plan
pnpm install --frozen-lockfilepnpm check --force: 30 core tests and 16 adapter tests; both packages retain 100% line/function coverage, plus typecheck, lint, and build.Adapter tests cover mount/fresh-cache reads, key changes, unmount cancellation, StrictMode, typed errors/defects, custom hashes, shared requests, injected services, mutation concurrency, and success handlers.
Compile-time negative cases reject missing runtime services and incorrect hook arguments.
Quality budget and complexity checks pass;
git diff --checkpasses.Pack both packages and install the tarballs in a blank npm project; verify the adapter's workspace dependency becomes
^0.3.0-beta.0.React 18.3.1 packed-package smoke: StrictMode fetch, mutation, key change, and unmount cancellation. Workspace suite runs with React 19.
Warm Turbo run hits all 8 task caches; moving build/coverage outputs aside and rerunning restores all artifacts from cache.
Cache probes: core source changes invalidate core and dependent adapter tasks, adapter-only source changes preserve all core hashes, shared lint configuration changes invalidate all tasks. Temporary probes were reverted.
Filtered adapter test run builds missing core outputs first, with cache bypassed.