mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-02-02 22:26:57 +01:00
Fix media re-rendering due to url object keep being recreated
This commit is contained in:
parent
d1b8d737cc
commit
806ad2c6a2
1 changed files with 4 additions and 1 deletions
|
@ -1477,7 +1477,10 @@ function MediaAttachment({
|
||||||
}) {
|
}) {
|
||||||
const supportsEdit = supports('@mastodon/edit-media-attributes');
|
const supportsEdit = supports('@mastodon/edit-media-attributes');
|
||||||
const { type, id, file } = attachment;
|
const { type, id, file } = attachment;
|
||||||
const url = file ? URL.createObjectURL(file) : attachment.url;
|
const url = useMemo(
|
||||||
|
() => (file ? URL.createObjectURL(file) : attachment.url),
|
||||||
|
[file, attachment.url],
|
||||||
|
);
|
||||||
console.log({ attachment });
|
console.log({ attachment });
|
||||||
const [description, setDescription] = useState(attachment.description);
|
const [description, setDescription] = useState(attachment.description);
|
||||||
const suffixType = type.split('/')[0];
|
const suffixType = type.split('/')[0];
|
||||||
|
|
Loading…
Reference in a new issue