Free Blob Storage after file unmount #142

Open
opened 2025-10-31 07:12:13 +00:00 by jkeffects · 0 comments
Owner

Blobs for displaying images or PDFs are stored in the browser memory, thus reducing the storage space available to the web app if not cleaned up after usage

  • Integration of a separate component that loads files via URL or receives a file and frees up storage space when unmounted.
  • The component reloads the display when the URL / file changes
// concept
const imageUrl = ref<string|File>(null);

function setImage(file) {
  if (imageUrl.value) {
    URL.revokeObjectURL(imageUrl.value);
  }
  imageUrl.value = URL.createObjectURL(file);
}

// Free storage on unmount
onUnmounted(() => {
  if (imageUrl.value) {
    URL.revokeObjectURL(imageUrl.value);
  }
});
Blobs for displaying images or PDFs are stored in the browser memory, thus reducing the storage space available to the web app if not cleaned up after usage - [ ] Integration of a separate component that loads files via URL or receives a file and frees up storage space when unmounted. - [ ] The component reloads the display when the URL / file changes ```js // concept const imageUrl = ref<string|File>(null); function setImage(file) { if (imageUrl.value) { URL.revokeObjectURL(imageUrl.value); } imageUrl.value = URL.createObjectURL(file); } // Free storage on unmount onUnmounted(() => { if (imageUrl.value) { URL.revokeObjectURL(imageUrl.value); } }); ```
jkeffects added this to the FF Admin Next milestone 2025-10-31 07:12:13 +00:00
jkeffects added this to the (deleted) project 2025-10-31 07:47:31 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
FF-Admin/ff-admin#142
No description provided.