From 5f4f3cc6c420d5fe37bf8f8dffa9368e75b9b60e Mon Sep 17 00:00:00 2001 From: Maze Winther Date: Thu, 31 Jul 2025 13:10:37 +0200 Subject: Merge pull request [#499](https://github.com/mazeincoding/AppCut/issues/499) --- apps/web/src/stores/project-store.ts | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'apps/web/src/stores') diff --git a/apps/web/src/stores/project-store.ts b/apps/web/src/stores/project-store.ts index 7bb38039..6744bdec 100644 --- a/apps/web/src/stores/project-store.ts +++ b/apps/web/src/stores/project-store.ts @@ -11,6 +11,7 @@ interface ProjectStore { savedProjects: TProject[]; isLoading: boolean; isInitialized: boolean; + invalidProjectIds?: Set; // Actions createNewProject: (name: string) => Promise; @@ -32,6 +33,11 @@ interface ProjectStore { searchQuery: string, sortOption: string ) => TProject[]; + + // Global invalid project ID tracking + isInvalidProjectId: (id: string) => boolean; + markProjectIdAsInvalid: (id: string) => void; + clearInvalidProjectIds: () => void; } export const useProjectStore = create((set, get) => ({ @@ -39,6 +45,7 @@ export const useProjectStore = create((set, get) => ({ savedProjects: [], isLoading: true, isInitialized: false, + invalidProjectIds: new Set(), createNewProject: async (name: string) => { const newProject: TProject = { @@ -357,4 +364,23 @@ export const useProjectStore = create((set, get) => ({ return sortedProjects; }, + + // Global invalid project ID tracking implementation + isInvalidProjectId: (id: string) => { + const invalidIds = get().invalidProjectIds || new Set(); + return invalidIds.has(id); + }, + + markProjectIdAsInvalid: (id: string) => { + set((state) => ({ + invalidProjectIds: new Set([ + ...(state.invalidProjectIds || new Set()), + id, + ]), + })); + }, + + clearInvalidProjectIds: () => { + set({ invalidProjectIds: new Set() }); + }, })); -- cgit v1.3.1