From 09b88d1fbe6d5d249773827e09f0d6e7b380ddc3 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 8 Feb 2022 19:25:08 +0000 Subject: [PATCH] Fix add existing space not showing any spaces (#7751) --- .../views/dialogs/AddExistingToSpaceDialog.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/views/dialogs/AddExistingToSpaceDialog.tsx b/src/components/views/dialogs/AddExistingToSpaceDialog.tsx index 0188fa4a06..118ee2766f 100644 --- a/src/components/views/dialogs/AddExistingToSpaceDialog.tsx +++ b/src/components/views/dialogs/AddExistingToSpaceDialog.tsx @@ -266,9 +266,11 @@ export const AddExistingToSpace: React.FC = ({ // only count spaces when alone as they're shown on a separate modal all on their own const numSpaces = (spacesRenderer && !dmsRenderer && !roomsRenderer) ? spaces.length : 0; + const numRooms = roomsRenderer ? rooms.length : 0; + const numDms = dmsRenderer ? dms.length : 0; let noResults = true; - if ((roomsRenderer && rooms.length > 0) || (dmsRenderer && dms.length > 0) || (numSpaces > 0)) { + if (numSpaces > 0 || numRooms > 0 || numDms > 0) { noResults = false; } @@ -287,9 +289,9 @@ export const AddExistingToSpace: React.FC = ({ }); }; - const roomsScrollState = getScrollState(scrollState, rooms.length); - const spacesScrollState = getScrollState(scrollState, numSpaces, rooms.length); - const dmsScrollState = getScrollState(scrollState, dms.length, numSpaces, rooms.length); + const roomsScrollState = getScrollState(scrollState, numRooms); + const spacesScrollState = getScrollState(scrollState, numSpaces, numRooms); + const dmsScrollState = getScrollState(scrollState, numDms, numSpaces, numRooms); return