diff --git a/ui/v2.5/src/components/Scenes/SceneDetails/Scene.tsx b/ui/v2.5/src/components/Scenes/SceneDetails/Scene.tsx index d0057476b..85e88a278 100644 --- a/ui/v2.5/src/components/Scenes/SceneDetails/Scene.tsx +++ b/ui/v2.5/src/components/Scenes/SceneDetails/Scene.tsx @@ -541,6 +541,17 @@ const SceneLoader: React.FC = () => { const { configuration } = useContext(ConfigurationContext); const { data, loading, error } = useFindScene(id ?? ""); + const [scene, setScene] = useState( + data?.findScene ?? undefined + ); + + // only update scene when loading is done + useEffect(() => { + if (!loading) { + setScene(data?.findScene ?? undefined); + } + }, [data, loading]); + const queryParams = useMemo( () => new URLSearchParams(location.search), [location.search] @@ -752,32 +763,34 @@ const SceneLoader: React.FC = () => { } } - if (loading) return ; + if (!scene && loading) return ; if (error) return ; - const scene = data?.findScene; - if (!scene) return ; + if (!loading && !scene) + return ; return (
- + {scene && ( + + )}