Skip to content

Commit

Permalink
(UNTESTED): fix target override
Browse files Browse the repository at this point in the history
  • Loading branch information
beebls committed Nov 9, 2024
1 parent 4e13bd2 commit 3ac1575
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ interface IThemeBrowserSharedStore
extends ThemeBrowserSharedStoreValues,
ThemeBrowserSharedStoreActions {}

const themeBrowserSharedStore = createStore<IThemeBrowserSharedStore>((set) => {
export const themeBrowserSharedStore = createStore<IThemeBrowserSharedStore>((set) => {
return {
browserCardSize: 3,
targetOverride: "",
Expand Down
8 changes: 7 additions & 1 deletion src/modules/theme-store/context/ThemeBrowserStore.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { FilterQueryResponse, ThemeQueryRequest, ThemeQueryResponse } from "@/ty
import { StoreApi, createStore, useStore } from "zustand";
import { getCSSLoaderState } from "@/backend";
import { isEqual } from "lodash";
import { getThemeBrowserSharedState } from "./ThemeBrowserSharedStore";
import { getThemeBrowserSharedState, themeBrowserSharedStore } from "./ThemeBrowserSharedStore";

interface ThemeBrowserStoreValues {
loading: boolean;
Expand Down Expand Up @@ -83,6 +83,12 @@ export function ThemeBrowserStoreProvider({
try {
await get().getFilters();
await get().getThemes();

themeBrowserSharedStore.subscribe((state, prevState) => {
if (state.targetOverride !== prevState.targetOverride) {
get().getThemes();
}
});
} catch (error) {}
},
getFilters: async () => {
Expand Down

0 comments on commit 3ac1575

Please sign in to comment.