-
Notifications
You must be signed in to change notification settings - Fork 148
workflow example #4032
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 01-21-feat_rivetkit_integrate_workflows_in_to_actors
Are you sure you want to change the base?
workflow example #4032
Conversation
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
How to use the Graphite Merge QueueAdd the label merge-queue to this PR to add it to 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. This stack of pull requests is managed by Graphite. Learn more about stacking. |
| // Workflow Sandbox - Actor Registry | ||
| // Each actor demonstrates a different workflow feature using actor-per-workflow pattern | ||
|
|
||
| import { setup } from "rivetkit"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 'setup' function is imported from 'rivetkit' but the module cannot be found. This is because the root package.json needs to have resolutions for RivetKit packages. Add 'rivetkit': 'workspace:*' to the resolutions in the root package.json.
Spotted by Graphite Agent (based on CI logs)
Is this helpful? React 👍 or 👎 to let us know.
Pull Request Review: Workflow ExampleThis PR adds a comprehensive workflow sandbox example and addresses several friction points in the RivetKit workflow API. Overall, this is a valuable contribution that improves developer experience and provides excellent documentation through a working example. ✅ Strengths1. Excellent Documentation
2. API ImprovementsThe PR addresses real friction points:
3. Comprehensive ExampleThe workflow-sandbox example demonstrates:
Each pattern is implemented as a separate actor with clean separation of concerns.
|
| import { timer } from "./actors/timer.ts"; | ||
| import { order } from "./actors/order.ts"; | ||
| import { batch } from "./actors/batch.ts"; | ||
| import { approval } from "./actors/approval.ts"; | ||
| import { dashboard } from "./actors/dashboard.ts"; | ||
| import { race } from "./actors/race.ts"; | ||
| import { payment } from "./actors/payment.ts"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These imports need to be sorted alphabetically to pass Biome linting. Run 'pnpm biome check --apply' to automatically fix this issue.
Spotted by Graphite Agent (based on CI logs)
Is this helpful? React 👍 or 👎 to let us know.
| useEffect(() => { | ||
| actor.connection?.getOrder().then(setOrder); | ||
| }, [actor.connection]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This creates an unhandled floating Promise. Add a .catch() handler to properly handle potential errors: actor.connection?.getOrder().then(setOrder).catch(error => console.error('Failed to get order:', error));
Spotted by Graphite Agent (based on CI logs)
Is this helpful? React 👍 or 👎 to let us know.
| useEffect(() => { | ||
| actor.connection?.getTask().then(setTask); | ||
| }, [actor.connection]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add error handling to this Promise: actor.connection?.getTask().then(setTask).catch(error => console.error('Failed to get task:', error));
Spotted by Graphite Agent (based on CI logs)
Is this helpful? React 👍 or 👎 to let us know.
| <button className="approve" onClick={() => onApprove("Admin")}> | ||
| Approve | ||
| </button> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If onApprove returns a Promise, handle it properly: onClick={() => { const result = onApprove('Admin'); if (result instanceof Promise) result.catch(err => console.error('Approval failed:', err)); }}
Spotted by Graphite Agent (based on CI logs)
Is this helpful? React 👍 or 👎 to let us know.

No description provided.