Repository navigation
Commit 41ed7fc
committed
fix: 图片导入在裁剪前不再释放解码后的原图
拆分 use-question-import 时,「离开页面释放原图」的 effect 依赖了每次渲染都会
变化的 imageFlow 对象,选好照片后的重新渲染就会释放原图,确认裁剪时 drawImage
报 "The image source is detached",图片导入无法创建识别任务。
- 释放逻辑移回持有原图引用的 useImageImportFlow,只在卸载时执行
- 新增单测:选好照片后重新渲染不释放原图,离开页面时释放一次1 parent 42c90e1 commit 41ed7fc
3 files changed
Lines changed: 22 additions & 5 deletions
File tree
- src
- __tests__/unit
- lib/hooks
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
130 | 148 | | |
131 | 149 | | |
132 | 150 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
57 | 60 | | |
58 | 61 | | |
59 | 62 | | |
| |||
210 | 213 | | |
211 | 214 | | |
212 | 215 | | |
213 | | - | |
214 | 216 | | |
215 | 217 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | 71 | | |
75 | 72 | | |
76 | 73 | | |
| |||
0 commit comments