`useRiveFile` does not handle errors thrown in RiveFile constructor
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 45/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- react, typescript
- 领域
- frontend
调研方向
Start at the useRiveFile hook and compare its error path with the try/catch around new RiveFile in js/src/rive.ts at lines 1817-1824. Review the RiveFile initData path around lines 1453-1457 and verify that a loading failure produces the hook's failed status without an uncaught error crashing the app.
由索引模型根据 Issue 内容生成。
描述
I want to use the status returned by the useRiveFile hook to fail gracefully if there is an error while loading the file, e.g. if the file at src is missing.
Currently, if there is an error during the initData method of RiveFile, firing the loadError event is immediately followed by throwing an Error (https://github.com/rive-app/rive-wasm/blob/55691eb4893e3056f2d5096fbc3f2e58142e8d79/js/src/rive.ts#L1453-L1457).
This makes the status returned by useRiveFile provide little value for this use case, since if status === 'failed', the app is going to crash anyways.
This is not an issue when using useRive without useRiveFile, because the call to new RiveFile is wrapped in a try / catch in the Rive constructor (https://github.com/rive-app/rive-wasm/blob/55691eb4893e3056f2d5096fbc3f2e58142e8d79/js/src/rive.ts#L1817-L1824).
I think similarly, useRiveFile should also catch errors thrown by new RiveFile. Without this error handling, I don't think I can use useRiveFile in production.
Other work-arounds also welcome!
Thank you!
- 主要语言
- TypeScript
- 星标
- 1.2k
- 派生
- 58
- 平均合并
- 52 分钟
- 30 天内合并 PR
- 4
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
rive-app/rive-react 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 38/100
rive-app/rive-react#410 · 1 条评论 ·
-
Fit.Layout doesn't reflow elements in canvas-lite可能已有人在做 @usero-agent 于 124 天前认领。 未关闭enhancement
难度 4/5 3-5 天 新手友好度 42/100
rive-app/rive-react#409 · 3 条评论 ·
-
Issue: Re-mount RiveComponent multiple times cause web page laggy可能已有人在做 @usero-agent 于 124 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 30/100
rive-app/rive-react#400 ·
-
triage
难度 3/5 1-2 天 新手友好度 45/100
rive-app/rive-react#392 ·
-
triage
难度 1/5 1 小时以内 新手友好度 55/100
rive-app/rive-react#386 · 1 个 reaction ·
查看 rive-app/rive-react 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 66/100
cockpit-project/cockpit-machines#2835 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
cloudflare/kumo#866 ·
维护者通常 1 天内回复
-
area:connector bug
难度 1/5 1 小时以内 新手友好度 82/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
tester-army/e2e#1015 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 1 天内回复