Extend on state change with previous state#1179
Closed
joshua1 wants to merge 531 commits intorivet-dev:mainfrom
Closed
Extend on state change with previous state#1179joshua1 wants to merge 531 commits intorivet-dev:mainfrom
joshua1 wants to merge 531 commits intorivet-dev:mainfrom
Conversation
* Add `get-port` as dev dep In rivet-dev#790 `get-port` was added to [`packages/actor-core/src/test/mod.ts`](packages/actor-core/src/test/mod.ts) Get an error when you run the example ```sh npx create-actor@0.7.9 npm run test ``` ``` ➜ npm run test > counter@0.0.0 test > vitest run RUN v3.1.1 /Users/username/git/actor-core-counter ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Failed Suites 1 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ FAIL tests/counter.test.ts [ tests/counter.test.ts ] Error: Cannot find package 'get-port' imported from /Users/username/git/actor-core-counter/node_modules/actor-core/dist/test/mod.js ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯ Test Files 1 failed (1) Tests no tests Start at 14:59:12 Duration 209ms (transform 24ms, setup 0ms, collect 0ms, tests 0ms, environment 0ms, prepare 35ms) ``` * How embarassing * Update yarn.lock
…instances of the same type` (rivet-dev#876)
Release-As: 0.9.7
Release-As: 0.9.8
Closes KIT-178, KIT-115 ### TL;DR Add Next.js framework support with a working example and update documentation links. ### What changed? - Added a new `@rivetkit/next-js` package with Next.js integration - Created a complete Next.js example application in `examples/next-js` - Updated the GitHub workflow to include templates from examples directory - Fixed the basePath handling in the core router to support custom API paths - Updated documentation links throughout the README to point to rivet.gg domain - Added a pkg.pr.new badge to the README for easy testing ### How to test? 1. Run the Next.js example: ```bash cd examples/next-js pnpm install pnpm dev ``` 2. Open http://localhost:3000 to see the counter example 3. Try incrementing the counter and changing the counter name 4. Verify the API routes work correctly at `/api/registry` ### Why make this change? Next.js is one of the most popular React frameworks, and this integration allows RivetKit to be easily used in Next.js applications. The example demonstrates how to set up actors, create API routes, and use the React hooks in a Next.js environment. This expands RivetKit's framework support and makes it more accessible to developers using Next.js.
…vet-dev#1158) The JSON encoding path in handleAction was expecting a raw array for action arguments, while the client was sending {a: [...]} format. This caused "Invalid JSON" errors when explicitly specifying encoding: "json" in the client. This fix ensures both JSON and CBOR encodings use the same ActionRequestSchema format for consistency, matching the client's expected behavior. 🤖 Generated with [opencode](https://opencode.ai) Co-authored-by: opencode <noreply@opencode.ai>
Release-As: 0.9.9
Closes FRONT-742 ### TL;DR Added connection liveness checking to detect and clean up stale WebSocket connections. ### What changed? - Implemented a connection liveness system that periodically checks if WebSocket and SSE connections are still active - Added `connectionLivenessInterval` and `connectionLivenessTimeout` configuration options to the actor lifecycle settings - Enhanced the `Conn` class with liveness tracking and checking capabilities - Added `getConnectionReadyState` method to connection drivers to report connection status - Created a test actor (`connLivenessActor`) and test suite to verify liveness functionality - Implemented internal event scheduling for periodic liveness checks - Added timestamp tracking for last seen activity on connections ### How to test? The PR includes a comprehensive test suite in `actor-conn.ts` that verifies: 1. Connections report correct liveness status 2. Dead connections are properly detected 3. Stale connections are automatically cleaned up after the timeout period 4. Active connections continue to function normally Run the tests with: ``` pnpm test ``` ### Why make this change? WebSocket connections can become stale or disconnected without proper notification, leading to resource leaks and potential issues with connection management. This change implements a robust mechanism to detect and clean up these stale connections automatically, improving system reliability and resource utilization. The liveness check system ensures that the actor framework maintains an accurate view of active connections and can properly manage resources by removing connections that are no longer active.
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. |
jog1t
reviewed
Aug 25, 2025
Collaborator
|
@joshua1 please resolve conflicts, and we can finally merge it! |
jog1t
approved these changes
Sep 18, 2025
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.
modify onStateChange so that previous state is also passed to the lifecycle event call back . This will help with granular broadcast where necessary after comparing new and previous state , as well as other comparisons as needed