Attempt to bypass image GC

dev
gravel 2 years ago
parent 59adb020fe
commit 83c62a197b
Signed by: gravel
GPG Key ID: C0538F3C906B308F

@ -44,6 +44,11 @@ const filteredCommunities = {
],
};
/**
* Hanging reference to preloaded images to avoid garbage collection.
*/
const preloadedImages = [];
// This can be achieved with `text-overflow: ellipsis` instead
// and generated entirely server-side.
const transformJoinURL = (join_link) => {
@ -134,8 +139,6 @@ function displayQRModal(communityID) {
}
function hideQRModal(communityID) {
dom.details_modal_room_icon().src = "";
dom.details_modal_qr_code().src = "";
dom.details_modal().close();
}
@ -228,13 +231,17 @@ function preloadImages() {
rowElement => rowElement.getAttribute(ATTRIBUTES.ROW.ROOM_ICON)
)
for (const identifier of identifiers) {
(new Image()).src = communityQRCodeURL(identifier);
const image = new Image();
image.src = communityQRCodeURL(identifier);
preloadedImages.push(image);
}
for (const icon of icons) {
if (!icon) {
continue;
}
(new Image()).src = icon;
const image = new Image();
image.src = icon;
preloadedImages.push(image);
}
}

Loading…
Cancel
Save