mirror of
https://github.com/cheeaun/phanpy.git
synced 2024-11-28 04:12:41 +03: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 { 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 });
|
||||
const [description, setDescription] = useState(attachment.description);
|
||||
const suffixType = type.split('/')[0];
|
||||
|
|
Loading…
Reference in a new issue