From 2744f7d5b9106c7c2eec69010e550e0939c23d80 Mon Sep 17 00:00:00 2001 From: ArthurMousatov <57199800+ArthurMousatov@users.noreply.github.com> Date: Thu, 27 Jul 2023 12:03:49 -0400 Subject: [PATCH] fix: added an early return on non-existent items (#2571) --- frontend/src/views/files/Listing.vue | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/frontend/src/views/files/Listing.vue b/frontend/src/views/files/Listing.vue index bdf4806b..b3d88e8e 100644 --- a/frontend/src/views/files/Listing.vue +++ b/frontend/src/views/files/Listing.vue @@ -606,10 +606,12 @@ export default { }, colunmsResize() { // Update the columns size based on the window width. + let items = css(["#listing.mosaic .item", ".mosaic#listing .item"]); + if (!items) return; + let columns = Math.floor( document.querySelector("main").offsetWidth / this.columnWidth ); - let items = css(["#listing.mosaic .item", ".mosaic#listing .item"]); if (columns === 0) columns = 1; items.style.width = `calc(${100 / columns}% - 1em)`; },