Properly cleanup an image when it is removed
This commit is contained in:
parent
6295d9b177
commit
03f992811d
@ -31,11 +31,11 @@ async function loadImageFromBlob(doc, evt, node, vm) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function cleanup(id, evt) {
|
function cleanup(node) {
|
||||||
const { src } = evt.target;
|
const src = node.el.src;
|
||||||
if (src.startsWith('blob:')) {
|
if (src.startsWith('blob:')) {
|
||||||
URL.revokeObjectURL(s);
|
URL.revokeObjectURL(src);
|
||||||
srcMap.remove(id);
|
srcMap.delete(node.key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ export function AttachmentImageView(doc, props) {
|
|||||||
onerror: [loadImageFromBlob, doc],
|
onerror: [loadImageFromBlob, doc],
|
||||||
_key: _id,
|
_key: _id,
|
||||||
_hooks: {
|
_hooks: {
|
||||||
didRemove: [cleanup, _id]
|
willRemove: cleanup
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
props || {}
|
props || {}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user