]> BookStack Code Mirror - bookstack/commitdiff
Patched gallery duplication on multi-image upload
authorDan Brown <redacted>
Mon, 24 Jan 2022 21:38:11 +0000 (21:38 +0000)
committerDan Brown <redacted>
Mon, 24 Jan 2022 21:38:11 +0000 (21:38 +0000)
Quick patch to clear the gallery display when getting the first page.
Duplication of the galler was occuring due to the mulitple upload events
loading the gallery mulitple times while only clearing the existing
gallery at the start of all refreshes.

A bit flashy in terms of user experience, as there will still be
mulitple load/clear events but fixes the duplication. Could be done more
elegently in future by communicating up image upload counts.

For #3160

resources/js/components/image-manager.js

index 6d05d3388af6f8a21809daad455b3d3d46dc4972..23a6c4cbb9bc1ffb29120997af3291dd36cb2d31 100644 (file)
@@ -122,6 +122,9 @@ class ImageManager {
         };
 
         const {data: html} = await window.$http.get(`images/${this.type}`, params);
+        if (params.page === 1) {
+            this.listContainer.innerHTML = '';
+        }
         this.addReturnedHtmlElementsToList(html);
         removeLoading(this.listContainer);
     }
Morty Proxy This is a proxified and sanitized view of the page, visit original site.