Skip to content

chore(examples): migrate to async API, add no-deprecated lint rule#194

Merged
mfazekas merged 3 commits intomainfrom
chore/examples-async-migration
Mar 27, 2026
Merged

chore(examples): migrate to async API, add no-deprecated lint rule#194
mfazekas merged 3 commits intomainfrom
chore/examples-async-migration

Conversation

@mfazekas
Copy link
Copy Markdown
Collaborator

Migrates all example/demo/exerciser files off the deprecated sync ViewModel API and enables @typescript-eslint/no-deprecated as a lint error to prevent regressions.

Examples migrated (sync useMemo chains → useViewModelInstance hook or useEffect+async):

  • RiveDataBindingExample, DataBindingArtboardsExample, FontFallbackExample, NestedViewModelExample — now use useViewModelInstance(file)
  • ManyViewModelsuseEffect + defaultArtboardViewModelAsync / createInstanceByNameAsync
  • MenuListExampleviewModelByNameAsync, createBlankInstanceAsync, prop.set() instead of prop.value =
  • QuickStartprop.value = 9 write → prop.set(9)

New exerciser: RiveDataBindingExampleExpApi — same as Data Binding but explicitly uses raw async calls (defaultArtboardViewModelAsync / createDefaultInstanceAsync) for comparison.

Lint rule: @typescript-eslint/no-deprecated: error scoped to src/** and example/src/**. Intentionally deprecated showcases (Events, SM inputs, Text runs) and library hooks pending async migration get eslint-disable with TODO comments.

Harness test: asserts that useRiveNumber delivers its initial value on first listener emission without requiring any prop update.

Copy link
Copy Markdown
Contributor

@HayesGordon HayesGordon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Adds an explicit test for the contract that `useRiveNumber` delivers its
initial value purely from the first listener emission on subscribe — no
prop change is required. Uses a tight 1 s timeout to make it fail fast
if the hook ever accidentally regresses to relying on a prop update cycle.
Mirror of the existing Data Binding exerciser but with WithViewModelSetup
replaced to use `defaultArtboardViewModelAsync()` and
`createDefaultInstanceAsync()` instead of the deprecated sync counterparts.
Useful for verifying the async path produces identical visual results.
@mfazekas mfazekas force-pushed the chore/examples-async-migration branch from 7ba48ca to d4d6195 Compare March 27, 2026 08:14
@mfazekas mfazekas merged commit e9779d2 into main Mar 27, 2026
9 checks passed
@mfazekas mfazekas deleted the chore/examples-async-migration branch March 27, 2026 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants