docs(js/react): add deprecation docs for various parameters in the high-level JS/React runtime and use new stateMachine param in examples - #897
Conversation
…gh-level JS/React runtime and use new stateMachine param in examples
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
There was a problem hiding this comment.
Pull request overview
Updates the Rive documentation site to reflect new deprecations introduced in the high-level JS (v2.41.0) and React (v4.33.0) runtimes, and to switch examples over to the new singular stateMachine parameter.
Changes:
- Replaces
stateMachineswithstateMachineacross Web + React runtime guides and examples. - Expands parameter/reference docs to document newly deprecated params/APIs (events, loops/state change, inputs/text runs) and introduces/clarifies
stateMachine. - Bumps the documented WebGL2 runtime version variable to
2.41.0.
Reviewed changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| runtimes/web/web-js.mdx | Updates getting-started examples to use stateMachine. |
| runtimes/web/state-machines.mdx | Adds guidance on stateMachine and updates examples. |
| runtimes/web/semantics.mdx | Updates semantics examples to use stateMachine. |
| runtimes/web/rive-parameters.mdx | Documents new stateMachine, adds deprecation sections/notes, updates types and API docs. |
| runtimes/web/preloading-wasm.mdx | Updates preloading example to use stateMachine. |
| runtimes/web/loading-assets.mdx | Updates asset-loading example to use stateMachine. |
| runtimes/web/layouts.mdx | Updates layout example to use stateMachine. |
| runtimes/web/fonts.mdx | Updates fonts example to use stateMachine. |
| runtimes/web/faq.mdx | Updates FAQ guidance and sample to use stateMachine. |
| runtimes/web/data-binding.mdx | Updates data-binding examples to use stateMachine. |
| runtimes/web/canvas-vs-webgl.mdx | Adds/updates example parameters to include artboard + stateMachine. |
| runtimes/web/caching-a-rive-file.mdx | Updates caching example to use stateMachine. |
| runtimes/web/artboards.mdx | Updates artboard example to include stateMachine. |
| runtimes/react/state-machines.mdx | Updates React state machine docs/examples to use stateMachine. |
| runtimes/react/semantics.mdx | Updates React semantics examples to use stateMachine. |
| runtimes/react/react.mdx | Updates React getting-started examples/props to use stateMachine. |
| runtimes/react/preloading-wasm.mdx | Updates React preloading example to use stateMachine. |
| runtimes/react/parameters-and-return-values.mdx | Clarifies useStateMachineInput deprecation and documents component props including deprecated ones. |
| runtimes/react/layouts.mdx | Updates React layouts examples to use stateMachine. |
| runtimes/react/fonts.mdx | Updates React fonts example to use stateMachine. |
| runtimes/react/data-binding.mdx | Updates React data-binding examples to use stateMachine. |
| runtimes/react/best-practices.mdx | Updates best-practices example to use stateMachine. |
| runtimes/react/artboards.mdx | Updates React artboards examples to include stateMachine. |
| docs.json | Updates versionWebGL2 variable to 2.41.0. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 25 out of 25 changed files in this pull request and generated no new comments.
Suppressed comments (2)
Previously missed (2) — in code that hasn't changed since the last review.
runtimes/react/parameters-and-return-values.mdx:147
- This section describes the package’s default export as
<RiveComponent />, but other React runtime docs in this PR use the default export component name<Rive />(e.g.runtimes/react/layouts.mdx). Renaming here avoids confusion between the default<Rive />component and theRiveComponentreturned fromuseRive().
### `<RiveComponent />`
The `RiveComponent` default export and the `RiveComponent` returned from the `useRive` hook are both to be rendered in the JSX of a component. As noted previously, all attributes and event handlers that can be passed to a `canvas` element can also be passed to the `Rive` component and used in the same manner.
#### Props
runtimes/web/web-js.mdx:95
- The
stateMachinebullet says it "must be supplied", but the sentence that follows describes a valid fallback behavior when it’s omitted (playing the first linear animation). This is internally contradictory and can mislead readers into thinking the parameter is required.
- `stateMachine` - A string representing the name of the state machine you wish to play. This must be supplied, or the Rive instance may only play the first linear animation it finds. In the next major version, the default behavior will be to play the artboard's default state machine when one exists.
lancesnider
left a comment
There was a problem hiding this comment.
One tiny nit, but feel free to merge if you disagree.
|
|
||
| `scrub(animationNames?: string | string[], value?: number): void` | ||
|
|
||
| Scrubs the specified timeline animations to the given time; if none are specified, scrubs all of them. Deprecated in `v2.41.0` — use a state machine to control playback instead. |
There was a problem hiding this comment.
Nit - in other parts of the doc, you do #### scrub() (deprecated)
There was a problem hiding this comment.
Yeah I had that initially but then realized its already under a H3 Deprecated section so I think its ok its omitted here
Starting in
v2.41.0/v4.33.0of the JS/React runtimes respectively, we added deprecations for the following:animations- initialization paramstateMachines- initialization paramautomaticallyHandleEvents- initialization param related to Rive eventsuseStateMachineInputhookAdds:
stateMachine- new param that is just a single string and will replace thestateMachinesparamThose changes also deprecate events/text run/state machine input APIs so those should be touched on in the parameters pages as well.