rive-app / rive-app/rive-react

Error after running animation for a longer period of time

Open
#137 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
1.2k
Forks
58
Avg merge
3h 23m
Merged PRs (30d)
6

Description

The code:

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import riveWasmUrl from '@rive-app/canvas/rive.wasm';
import {
	Alignment,
	Fit,
	Layout,
	useRive,
	useStateMachineInput,
	RuntimeLoader,
} from '@rive-app/react-canvas';
import { FC, useEffect } from 'react';

// For <link /> preload in the root of the app
RuntimeLoader.setWasmUrl(riveWasmUrl);

const riveGameStates = new Map<GameData['gameState'], number>([
	['state1', 1],
	['state2', 2],
	['state3', 3],
	['state4', 4],
]);

export const WhenMoonBroAnimation: FC = (props) => {
	const toast = useToast();

	const { rive, RiveComponent } = useRive({
		src: '/file.riv',
		stateMachines: 'State Machine',
		autoplay: true,
		artboard: 'Main Artboard',
		layout: new Layout({
			fit: Fit.Cover,
			alignment: Alignment.Center,
		}),
	});

	const { data: gameState } = useCrashGameData({
		select: (data) => data.gameState,
	});

	const sceneInput = useStateMachineInput(rive, 'State Machine', 'Scene');

	useEffect(() => {
		if (gameState && sceneInput) {
			sceneInput.value = riveGameStates.get(gameState) ?? 1;
		}
	}, [gameState, sceneInput]);

	return <RiveComponent width="100%" height="100%" {...props} />;
};

After running the animation for a longer period of time (approx 1h), I get the following error RuntimeError: Aborted(). Build with -sASSERTIONS for more info..

Anybody has any idea what I can do? The animation should be running non-stop

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reported component code, especially RuntimeLoader.setWasmUrl, useRive, and the long-running state-machine animation. Reproduce the failure with the animation running for about an hour, then inspect the Rive WASM runtime and browser errors to identify what triggers the abort. Done means the animation runs continuously without the RuntimeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript, wasm
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.