Skip to content

Conversation

@mfazekas
Copy link
Collaborator

@mfazekas mfazekas commented Jan 22, 2026

Summary

  • artboardName and viewModelName are now mutually exclusive (TypeScript discriminated unions)
  • Clarified docs: "ViewModel assigned to artboard" instead of implying ownership

API

// RiveFile source - pick ONE of: default, artboardName, or viewModelName
useViewModelInstance(riveFile, {
  instanceName?: string       // which instance (default if omitted)
})
// OR
useViewModelInstance(riveFile, {
  artboardName: string,       // get ViewModel assigned to this artboard
  instanceName?: string
})
// OR
useViewModelInstance(riveFile, {
  viewModelName: string,      // get ViewModel by name (file-wide)
  instanceName?: string
})

// ViewModel source (unchanged)
useViewModelInstance(viewModel, {
  name?: string,
  useNew?: boolean
})

@mfazekas mfazekas marked this pull request as ready for review January 22, 2026 08:18
@mfazekas mfazekas requested a review from HayesGordon January 22, 2026 08:18
…iewModelInstance

For RiveFile source, adds viewModelName to select a ViewModel by name via
viewModelByName(), and renames name to instanceName for clarity.
- artboardName and viewModelName are now mutually exclusive (enforced by TypeScript)
- Renamed 'name' to 'instanceName' in ViewModel params for consistency
- Clarified docs: "ViewModel assigned to artboard" instead of implying ownership
@mfazekas mfazekas force-pushed the feat/use-view-model-instance-options branch from e1bbf9d to 3238f80 Compare January 23, 2026 11:33
Copy link
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! We'll need to update the docs to reflect this as well.

@mfazekas mfazekas merged commit 6c6a1a9 into main Jan 23, 2026
8 checks passed
@mfazekas mfazekas deleted the feat/use-view-model-instance-options branch January 23, 2026 15:50
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.

3 participants