We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 24ce242 commit 2d35e25Copy full SHA for 2d35e25
src/hooks/useRiveFile.ts
@@ -73,7 +73,7 @@ type RiveFileHookResult =
73
| { riveFile: null; isLoading: false; error: string };
74
75
export function useRiveFile(
76
- input: RiveFileInput,
+ input: RiveFileInput | undefined,
77
options: UseRiveFileOptions = {}
78
): RiveFileHookResult {
79
const [result, setResult] = useState<RiveFileHookResult>({
@@ -95,6 +95,14 @@ export function useRiveFile(
95
try {
96
const currentInput = input;
97
98
+ if (currentInput == null) {
99
+ setResult({
100
+ riveFile: null,
101
+ isLoading: false,
102
+ error: 'No Rive file input provided.',
103
+ });
104
+ return;
105
+ }
106
if (typeof currentInput === 'string') {
107
if (
108
currentInput.startsWith('http://') ||
0 commit comments