Conversation
|
🚅 Deployed to the rivet-pr-4485 environment in rivet-frontend
|
Code Review: feat(rivetkit/react): add suspense supportOverall this is a well-thought-out implementation with a solid test suite. A few issues worth addressing before merge. Bug:
Potential double- When suspense is enabled and the actor is cached+idle, a microtask is queued on both the cache-hit and cache-miss paths. React's strict mode double-invokes renders, so two microtasks could be queued before either fires. The
If Comment style (CLAUDE.md) Per the project's style guide, comments should be complete sentences. The comment Removed JSDoc comments
Minor: conditional
Tests look solid The test suite covers the key scenarios well: initial connecting state, error exposure, |

Description
This pull request adds React Suspense support to the
@rivetkit/reactpackage, allowing components to suspend while actor connections are being established. The implementation includes a newsuspenseoption for theuseActorhook that integrates with React's<Suspense>boundary for declarative loading states and<ErrorBoundary>for error handling.Key changes include:
suspenseoption toActorOptionsandActorStateReferenceinterfacesType of change
How Has This Been Tested?
The changes have been tested with a comprehensive test suite that covers:
Tests use mock clients and connections to simulate various connection scenarios and verify the correct behavior in both synchronous and asynchronous contexts.
Checklist: