From a088b2da1dbe216ec57728c7ce0eca42773510b7 Mon Sep 17 00:00:00 2001 From: espenkalle Date: Fri, 2 Feb 2024 11:11:48 +0100 Subject: [PATCH 1/2] fix(garden): :bug: added condition for rendering of viewsettings Dont render viewsettings before virtual garden is init. this prevents the sidebar from moving around --- packages/garden/src/lib/components/Garden.tsx | 14 +++++--------- .../VirtualContainer/VirtualContainer.tsx | 15 +++++++++++---- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/packages/garden/src/lib/components/Garden.tsx b/packages/garden/src/lib/components/Garden.tsx index 94e12c6e9..d67ba9ada 100644 --- a/packages/garden/src/lib/components/Garden.tsx +++ b/packages/garden/src/lib/components/Garden.tsx @@ -76,7 +76,7 @@ export function Garden, TContext = un }: GardenProps): JSX.Element | null { const client = useRef(new QueryClient()); const [groupingKeys, setGroupingKeys] = useState(initialGrouping); - + const [isLoading, setIsLoading] = useState(true); const [timeInterval, updateTimeInterval] = useState(initialTimeInterval ?? null); const onChangetimeInterval = (timeInterval: string | null) => { updateTimeInterval(timeInterval); @@ -116,12 +116,8 @@ export function Garden, TContext = un customViews={customViews} visuals={visuals} > - - - - { - // Hides ViewSettings sidebar when sidesheet is open - selected ? null : ( + + {selected || isLoading ? null : ( , TContext = un onChangeTimeInterval={onChangetimeInterval} setGroupingKeys={setGroupingKeys} /> - ) - } + )} + diff --git a/packages/garden/src/lib/components/VirtualContainer/VirtualContainer.tsx b/packages/garden/src/lib/components/VirtualContainer/VirtualContainer.tsx index 2df885df2..0c2f0540a 100644 --- a/packages/garden/src/lib/components/VirtualContainer/VirtualContainer.tsx +++ b/packages/garden/src/lib/components/VirtualContainer/VirtualContainer.tsx @@ -1,24 +1,27 @@ +import { Icon } from '@equinor/eds-core-react'; +import { info_circle } from '@equinor/eds-icons'; +import { useEffect } from 'react'; +import styled from 'styled-components'; import { useItemWidths } from '../../hooks'; import { useGarden } from '../../hooks/useGarden'; import { useGardenConfig } from '../../hooks/useGardenConfig'; import { ExpandProvider } from '../ExpandProvider'; import { GardenDataSource } from '../Garden'; import { VirtualGarden } from '../VirtualGarden'; -import { StyledVirtualContainer } from './virtualContainer.styles'; -import { info_circle } from '@equinor/eds-icons'; -import { Icon } from '@equinor/eds-core-react'; -import styled from 'styled-components'; import { SplashScreen } from '../splashScreen/SplashScreen'; +import { StyledVirtualContainer } from './virtualContainer.styles'; Icon.add({ info_circle }); type VirtualContainerProps = { dataSource: GardenDataSource; context: TContext; + setIsLoading: (isLoading: boolean) => void; }; export const VirtualContainer = ({ dataSource, context, + setIsLoading, }: VirtualContainerProps): JSX.Element | null => { const { onClickItem } = useGardenConfig(); const { gardenMetaQuery } = useGarden(); @@ -27,6 +30,10 @@ export const VirtualContainer = ({ return ; } + useEffect(() => { + if (!gardenMetaQuery.isLoading) setIsLoading(false); + }, [gardenMetaQuery.isLoading]); + if (!gardenMetaQuery.data) { // Will never happen when suspense is true throw new Error(); From d5c60dd037398758c89a4567d953efce771fe7c8 Mon Sep 17 00:00:00 2001 From: espenkalle Date: Fri, 2 Feb 2024 12:13:15 +0100 Subject: [PATCH 2/2] bump --- packages/garden/package.json | 2 +- packages/workspace-fusion/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/garden/package.json b/packages/garden/package.json index 4216893aa..452fcb372 100644 --- a/packages/garden/package.json +++ b/packages/garden/package.json @@ -1,6 +1,6 @@ { "name": "@equinor/workspace-garden", - "version": "7.0.0", + "version": "7.0.1", "type": "module", "sideEffects": false, "license": "MIT", diff --git a/packages/workspace-fusion/package.json b/packages/workspace-fusion/package.json index 776be0c31..5360306d9 100644 --- a/packages/workspace-fusion/package.json +++ b/packages/workspace-fusion/package.json @@ -1,6 +1,6 @@ { "name": "@equinor/workspace-fusion", - "version": "7.0.3", + "version": "7.0.4", "type": "module", "sideEffects": false, "license": "MIT",