From 8ed6da566da398fb32b0d9ef2dcf09ddab04bf7a Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 8 Feb 2022 17:10:15 +0000 Subject: [PATCH 1/2] Fix add existing space not showing any spaces --- src/components/views/dialogs/AddExistingToSpaceDialog.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/views/dialogs/AddExistingToSpaceDialog.tsx b/src/components/views/dialogs/AddExistingToSpaceDialog.tsx index 0188fa4a066..79176efb881 100644 --- a/src/components/views/dialogs/AddExistingToSpaceDialog.tsx +++ b/src/components/views/dialogs/AddExistingToSpaceDialog.tsx @@ -266,6 +266,8 @@ 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)) { @@ -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
Date: Tue, 8 Feb 2022 18:39:03 +0000 Subject: [PATCH 2/2] Simplify expression --- src/components/views/dialogs/AddExistingToSpaceDialog.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/views/dialogs/AddExistingToSpaceDialog.tsx b/src/components/views/dialogs/AddExistingToSpaceDialog.tsx index 79176efb881..118ee2766fa 100644 --- a/src/components/views/dialogs/AddExistingToSpaceDialog.tsx +++ b/src/components/views/dialogs/AddExistingToSpaceDialog.tsx @@ -270,7 +270,7 @@ export const AddExistingToSpace: React.FC = ({ 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; }