Skip to content

Commit f1c4d29

Browse files
committed
Removes unused setProjects function from context
Eliminates the unused setProjects function from the ProjectsContext to simplify the context structure and remove unnecessary code. This enhances maintainability and reduces potential confusion. Removes unused setProjects function from context Simplifies the ProjectsContext by removing the unused setProjects function. This improves maintainability, reduces potential confusion, and eliminates unnecessary code. Adds a warning log to ProjectRepository for better debugging when cached project decoding fails.
1 parent a9a64de commit f1c4d29

File tree

3 files changed

+1
-3
lines changed

3 files changed

+1
-3
lines changed

src/common/context/ProjectsContext.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,9 @@ export const SidebarTogglableContext = createContext<boolean>(true)
88
type ProjectsContextValue = {
99
refreshing: boolean,
1010
projects: Project[],
11-
setProjects: (projects: Project[]) => void
1211
}
1312

1413
export const ProjectsContext = createContext<ProjectsContextValue>({
1514
refreshing: false,
1615
projects: [],
17-
setProjects: () => {}
1816
})

src/features/projects/domain/ProjectRepository.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export default class ProjectRepository implements IProjectRepository {
2525
try {
2626
return ZodJSONCoder.decode(ProjectSchema.array(), string)
2727
} catch { // swallow decode errors and treat as missing cache
28+
console.warn("[ProjectRepository] Failed to decode cached projects – treating as cache miss")
2829
return undefined
2930
}
3031
}

src/features/projects/view/ProjectsContextProvider.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ const ProjectsContextProvider = ({
5454
value={{
5555
projects,
5656
refreshing,
57-
setProjects: setProjectsAndRefreshed,
5857
}}
5958
>
6059
{children}

0 commit comments

Comments
 (0)