Skip to content

Commit

Permalink
rename to loadedstyles
Browse files Browse the repository at this point in the history
  • Loading branch information
alextaing committed Oct 24, 2023
1 parent 9361d47 commit 258b587
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion packages/studio-ui/src/hooks/useInjectUserStyles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default function useInjectUserStyles(
iframeDocument: Document | undefined
) {
const [userStyleImports, loadedStyles] = useStudioStore(
(store) => [getUserStyleImports(store), store.loadingProgress.loadedStyles],
(store) => [getUserStyleImports(store), store.loadedStyles.loadedStyles],
isEqual
);

Expand Down
4 changes: 2 additions & 2 deletions packages/studio-ui/src/store/models/StudioStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import SiteSettingSlice from "./slices/SiteSettingsSlice";
import StudioConfigSlice from "./slices/StudioConfigSlice";
import EnvDataSlice from "./slices/EnvDataSlice";
import GitDataSlice from "./slices/GitDataSlice";
import LoadingProgressSlice from "./slices/LoadingProgressSlice";
import LoadedStylesSlice from "./slices/LoadedStylesSlice";

/**
* The overall shape of the Zustand store as the state manager for Studio.
Expand All @@ -28,5 +28,5 @@ export type StudioStore = {
envData: EnvDataSlice;
gitData: GitDataSlice;
accountContent: AccountContentSlice;
loadingProgress: LoadingProgressSlice;
loadedStyles: LoadedStylesSlice;
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default interface LoadingProgressSlice {
export default interface LoadedStylesSlice {
loadedStyles: Set<string>;
addLoadedStyle: (style: string) => void;
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import LoadingProgressSlice from "../models/slices/LoadingProgressSlice";
import LoadedStylesSlice from "../models/slices/LoadedStylesSlice";
import { SliceCreator } from "../models/utils";

const createLoadingProgressSlice: SliceCreator<LoadingProgressSlice> = (
const createLoadedStylesSlice: SliceCreator<LoadedStylesSlice> = (
set
) => ({
loadedStyles: new Set<string>(),
Expand All @@ -12,4 +12,4 @@ const createLoadingProgressSlice: SliceCreator<LoadingProgressSlice> = (
},
});

export default createLoadingProgressSlice;
export default createLoadedStylesSlice;
4 changes: 2 additions & 2 deletions packages/studio-ui/src/store/useStudioStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import createEnvDataSlice from "./slices/createEnvDataSlice";
import createGitDataSlice from "./slices/createGitDataSlice";
import createAccountContentSlice from "./slices/accountContent/createAccountContentSlice";
import createLayoutSlice from "./slices/createLayoutSlice";
import createLoadingProgressSlice from "./slices/createLoadingProgressSlice";
import createLoadedStylesSlice from "./slices/createLoadedStylesSlice";

enableMapSet();

Expand Down Expand Up @@ -53,7 +53,7 @@ const useStudioStore = create<StudioStore>()(
envData: lens(createEnvDataSlice),
gitData: lens(createGitDataSlice),
accountContent: lens(createAccountContentSlice),
loadingProgress: lens(createLoadingProgressSlice),
loadedStyles: lens(createLoadedStylesSlice),
};
})
)
Expand Down
2 changes: 1 addition & 1 deletion packages/studio-ui/src/utils/loadUserAssets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export function loadComponents(): Promise<void>[] {
*/
export function loadStyling(): Promise<void>[] {
const studioStore = useStudioStore.getState();
const addLoadedStyle = studioStore.loadingProgress.addLoadedStyle;
const addLoadedStyle = studioStore.loadedStyles.addLoadedStyle;
const pages = Object.values(studioStore.pages.pages);
const layouts = Object.values(studioStore.layouts.layoutNameToLayoutState);
const fileMetadatas = Object.values(
Expand Down

0 comments on commit 258b587

Please sign in to comment.