From ee8a85f83d99f495e117c624b2117593b21dcd31 Mon Sep 17 00:00:00 2001 From: Alex Taing Date: Tue, 24 Oct 2023 13:42:53 -0400 Subject: [PATCH] rename store var --- packages/studio-ui/src/hooks/useInjectUserStyles.tsx | 10 +++++----- .../src/store/models/slices/LoadedStylesSlice.ts | 4 ++-- .../src/store/slices/createLoadedStylesSlice.ts | 6 +++--- packages/studio-ui/src/utils/loadUserAssets.tsx | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/studio-ui/src/hooks/useInjectUserStyles.tsx b/packages/studio-ui/src/hooks/useInjectUserStyles.tsx index d5462dbf5..47c47d702 100644 --- a/packages/studio-ui/src/hooks/useInjectUserStyles.tsx +++ b/packages/studio-ui/src/hooks/useInjectUserStyles.tsx @@ -13,8 +13,8 @@ import { StudioStore } from "../store/models/StudioStore"; export default function useInjectUserStyles( iframeDocument: Document | undefined ) { - const [userStyleImports, loadedStyles] = useStudioStore( - (store) => [getUserStyleImports(store), store.loadedStyles.loadedStyles], + const [userStyleImports, loadedStyleFilepaths] = useStudioStore( + (store) => [getUserStyleImports(store), store.loadedStyles.loadedStyleFilepaths], isEqual ); @@ -31,12 +31,12 @@ export default function useInjectUserStyles( }; /** - * loadedStyles is watched by this useEffect hook to - * account for the race condition where this hook is + * loadedStyleFilepaths is watched by this useEffect hook to + * account for the race condition where this hook is * called before all user styles are added to Studio's * document head. */ - }, [iframeDocument, userStyleImports, loadedStyles]); + }, [iframeDocument, userStyleImports, loadedStyleFilepaths]); } function getUserStyleImports(store: StudioStore): string[] { diff --git a/packages/studio-ui/src/store/models/slices/LoadedStylesSlice.ts b/packages/studio-ui/src/store/models/slices/LoadedStylesSlice.ts index b980cd445..86a383c78 100644 --- a/packages/studio-ui/src/store/models/slices/LoadedStylesSlice.ts +++ b/packages/studio-ui/src/store/models/slices/LoadedStylesSlice.ts @@ -1,4 +1,4 @@ export default interface LoadedStylesSlice { - loadedStyles: Set; - addLoadedStyle: (style: string) => void; + loadedStyleFilepaths: Set; + addLoadedStyleFilepath: (style: string) => void; } diff --git a/packages/studio-ui/src/store/slices/createLoadedStylesSlice.ts b/packages/studio-ui/src/store/slices/createLoadedStylesSlice.ts index 474546435..295629b11 100644 --- a/packages/studio-ui/src/store/slices/createLoadedStylesSlice.ts +++ b/packages/studio-ui/src/store/slices/createLoadedStylesSlice.ts @@ -2,10 +2,10 @@ import LoadedStylesSlice from "../models/slices/LoadedStylesSlice"; import { SliceCreator } from "../models/utils"; const createLoadedStylesSlice: SliceCreator = (set) => ({ - loadedStyles: new Set(), - addLoadedStyle: (style: string) => { + loadedStyleFilepaths: new Set(), + addLoadedStyleFilepath: (styleFilepath: string) => { set((store) => { - store.loadedStyles.add(style); + store.loadedStyleFilepaths.add(styleFilepath); }); }, }); diff --git a/packages/studio-ui/src/utils/loadUserAssets.tsx b/packages/studio-ui/src/utils/loadUserAssets.tsx index 3f4f9d3ee..b5dade4b5 100644 --- a/packages/studio-ui/src/utils/loadUserAssets.tsx +++ b/packages/studio-ui/src/utils/loadUserAssets.tsx @@ -42,7 +42,7 @@ export function loadComponents(): Promise[] { */ export function loadStyling(): Promise[] { const studioStore = useStudioStore.getState(); - const addLoadedStyle = studioStore.loadedStyles.addLoadedStyle; + const addLoadedStyle = studioStore.loadedStyles.addLoadedStyleFilepath; const pages = Object.values(studioStore.pages.pages); const layouts = Object.values(studioStore.layouts.layoutNameToLayoutState); const fileMetadatas = Object.values(