@@ -14,7 +14,7 @@ import {
1414 RiveView ,
1515 useRive ,
1616 useRiveFile ,
17- useViewModelInstanceAsync ,
17+ useViewModelInstance ,
1818 type RiveFile ,
1919 type RiveFileInput ,
2020 type RiveViewRef ,
@@ -58,7 +58,8 @@ function ArtboardProbe({
5858 artboardName : string ;
5959 ctx : AsyncCtx ;
6060} ) {
61- const { instance, error, isLoading } = useViewModelInstanceAsync ( file , {
61+ const { instance, error, isLoading } = useViewModelInstance ( file , {
62+ async : true ,
6263 artboardName,
6364 } ) ;
6465 useEffect ( ( ) => {
@@ -84,7 +85,8 @@ function ViewModelProbe({
8485 onInit ?: ( vmi : ViewModelInstance ) => void ;
8586 ctx : AsyncCtx ;
8687} ) {
87- const { instance, error, isLoading } = useViewModelInstanceAsync ( file , {
88+ const { instance, error, isLoading } = useViewModelInstance ( file , {
89+ async : true ,
8890 viewModelName,
8991 onInit,
9092 } ) ;
@@ -111,7 +113,8 @@ function InstanceNameProbe({
111113 instanceName : string ;
112114 ctx : AsyncCtx ;
113115} ) {
114- const { instance, error, isLoading } = useViewModelInstanceAsync ( file , {
116+ const { instance, error, isLoading } = useViewModelInstance ( file , {
117+ async : true ,
115118 viewModelName,
116119 instanceName,
117120 } ) ;
@@ -134,7 +137,9 @@ function FixedSourceProbe({
134137 source : RiveFile | null | undefined ;
135138 ctx : AsyncCtx ;
136139} ) {
137- const { instance, error, isLoading } = useViewModelInstanceAsync ( source ) ;
140+ const { instance, error, isLoading } = useViewModelInstance ( source , {
141+ async : true ,
142+ } ) ;
138143 useEffect ( ( ) => {
139144 ctx . instance = instance ;
140145 ctx . error = error ;
@@ -157,7 +162,9 @@ function FileErrorProbe({
157162 ctx : FileErrorCtx ;
158163} ) {
159164 const { riveFile, error : fileError } = useRiveFile ( input ) ;
160- const { instance, error, isLoading } = useViewModelInstanceAsync ( riveFile ) ;
165+ const { instance, error, isLoading } = useViewModelInstance ( riveFile , {
166+ async : true ,
167+ } ) ;
161168 useEffect ( ( ) => {
162169 ctx . fileErrored = fileError != null ;
163170 ctx . instance = instance ;
@@ -176,7 +183,7 @@ function FileErrorProbe({
176183// while the legacy backend resolves undefined; the hook must map both to the
177184// same friendly error instead of leaking a raw native message.
178185
179- describe ( 'useViewModelInstanceAsync : unknown artboard name' , ( ) => {
186+ describe ( 'useViewModelInstance async : unknown artboard name' , ( ) => {
180187 it ( 'surfaces the friendly "not found" error instead of the raw native message' , async ( ) => {
181188 const file = await loadFile ( ) ;
182189 const ctx = createCtx ( ) ;
@@ -211,7 +218,7 @@ describe('useViewModelInstanceAsync: unknown artboard name', () => {
211218// throwing onInit silently blank-screened. These lock the contract the fixed
212219// example now relies on: a throw becomes `error`, a clean onInit resolves.
213220
214- describe ( 'useViewModelInstanceAsync : onInit' , ( ) => {
221+ describe ( 'useViewModelInstance async : onInit' , ( ) => {
215222 it ( 'surfaces an onInit throw as error and leaves instance null' , async ( ) => {
216223 const file = await loadFile ( ) ;
217224 const ctx = createCtx ( ) ;
@@ -258,7 +265,7 @@ describe('useViewModelInstanceAsync: onInit', () => {
258265// terminate on `null`, otherwise a consumer keying a spinner off `isLoading`
259266// hangs forever with no signal.
260267
261- describe ( 'useViewModelInstanceAsync : null vs undefined source' , ( ) => {
268+ describe ( 'useViewModelInstance async : null vs undefined source' , ( ) => {
262269 it ( 'stays loading while the source is undefined (file still resolving)' , async ( ) => {
263270 const ctx = createCtx ( ) ;
264271 await render ( < FixedSourceProbe source = { undefined } ctx = { ctx } /> ) ;
@@ -299,7 +306,7 @@ describe('useViewModelInstanceAsync: null vs undefined source', () => {
299306// `contains()` pre-check). Asserting a cause per-platform would pin that
300307// accidental divergence, so only its shape is checked when present.
301308
302- describe ( 'useViewModelInstanceAsync : instance creation failure' , ( ) => {
309+ describe ( 'useViewModelInstance async : instance creation failure' , ( ) => {
303310 it ( 'keeps a clean not-found message on every backend (cause optional)' , async ( ) => {
304311 const file = await loadFile ( ) ;
305312 const ctx = createCtx ( ) ;
@@ -347,7 +354,9 @@ describe('useViewModelInstanceAsync: instance creation failure', () => {
347354
348355function RefSourceConsumer ( { file, ctx } : { file : RiveFile ; ctx : AsyncCtx } ) {
349356 const { riveViewRef, setHybridRef } = useRive ( ) ;
350- const { instance, error, isLoading } = useViewModelInstanceAsync ( riveViewRef ) ;
357+ const { instance, error, isLoading } = useViewModelInstance ( riveViewRef , {
358+ async : true ,
359+ } ) ;
351360 useEffect ( ( ) => {
352361 ctx . instance = instance ;
353362 ctx . error = error ;
@@ -370,7 +379,9 @@ function EagerRefConsumer({ file, ctx }: { file: RiveFile; ctx: AsyncCtx }) {
370379 // Raw hybridRef: the ref is exposed the moment the native view attaches,
371380 // before awaitViewReady/auto-bind complete — the widest race window.
372381 const [ viewRef , setViewRef ] = useState < RiveViewRef | undefined > ( undefined ) ;
373- const { instance, error, isLoading } = useViewModelInstanceAsync ( viewRef ) ;
382+ const { instance, error, isLoading } = useViewModelInstance ( viewRef , {
383+ async : true ,
384+ } ) ;
374385 useEffect ( ( ) => {
375386 ctx . instance = instance ;
376387 ctx . error = error ;
@@ -397,7 +408,7 @@ function EagerRefConsumer({ file, ctx }: { file: RiveFile; ctx: AsyncCtx }) {
397408// getViewModelInstance() read races the bind and can settle a terminal
398409// { instance: null } on fast mounts.
399410
400- describe ( 'useViewModelInstanceAsync : RiveViewRef source' , ( ) => {
411+ describe ( 'useViewModelInstance async : RiveViewRef source' , ( ) => {
401412 it ( 'resolves the auto-bound instance from a useRive view ref' , async ( ) => {
402413 // getViewModelInstance() returns null on Android experimental — auto-bind
403414 // doesn't expose the VMI handle to JS yet (same skip as autoplay.harness).
@@ -438,7 +449,7 @@ describe('useViewModelInstanceAsync: RiveViewRef source', () => {
438449// natives normalize this to resolve-null so the hook's documented
439450// { instance: null, error: null } state is reachable on every backend.
440451
441- describe ( 'useViewModelInstanceAsync : file without a default ViewModel' , ( ) => {
452+ describe ( 'useViewModelInstance async : file without a default ViewModel' , ( ) => {
442453 it ( 'resolves null with no error' , async ( ) => {
443454 const file = await RiveFileFactory . fromSource ( NO_DEFAULT_VM , undefined ) ;
444455 const ctx = createCtx ( ) ;
0 commit comments