diff --git a/src/store/coursePlannerStore.js b/src/store/coursePlannerStore.js index da956503..b886b229 100644 --- a/src/store/coursePlannerStore.js +++ b/src/store/coursePlannerStore.js @@ -12,7 +12,8 @@ const useCourseStore = create( }), { name: 'resources', - storage: typeof window !== 'undefined' ? localStorage : undefined, + getStorage: () => localStorage + // storage: typeof window !== 'undefined' ? localStorage : undefined, } ) ); diff --git a/src/store/manageUserStore.js b/src/store/manageUserStore.js index bffe417b..52a3b9f3 100644 --- a/src/store/manageUserStore.js +++ b/src/store/manageUserStore.js @@ -37,7 +37,8 @@ const manageUserStore = create( }), { name: 'fieldData', - storage: typeof window !== 'undefined' ? localStorage : undefined, + getStorage: () => localStorage + // getStorage: () => typeof window !== 'undefined' ? localStorage : undefined, } ) ); diff --git a/src/store/reassignLearnerStore.js b/src/store/reassignLearnerStore.js index 9a404311..fadd2b20 100644 --- a/src/store/reassignLearnerStore.js +++ b/src/store/reassignLearnerStore.js @@ -21,7 +21,8 @@ const reassignLearnerStore = create( }), { name: 'teacherApp', - storage: typeof window !== 'undefined' ? localStorage : undefined, + getStorage: () => localStorage + // storage: typeof window !== 'undefined' ? localStorage : undefined, } ) ); diff --git a/src/store/store.js b/src/store/store.js index d0305253..90f3123a 100644 --- a/src/store/store.js +++ b/src/store/store.js @@ -19,7 +19,8 @@ const useStore = create( }), { name: 'teacherApp', - storage: typeof window !== 'undefined' ? localStorage : undefined, + getStorage: () => localStorage + // storage: typeof window !== 'undefined' ? localStorage : undefined, } ) ); diff --git a/src/store/taxonomyStore.js b/src/store/taxonomyStore.js index db477a87..30b54cfa 100644 --- a/src/store/taxonomyStore.js +++ b/src/store/taxonomyStore.js @@ -25,7 +25,8 @@ const taxonomyStore = create( }), { name: 'taxonomyTeacher', - storage: typeof window !== 'undefined' ? localStorage : undefined, + getStorage: () => localStorage + // storage: typeof window !== 'undefined' ? localStorage : undefined, } ) ); diff --git a/src/utils/Helper.ts b/src/utils/Helper.ts index b42d0d07..4163a1a3 100644 --- a/src/utils/Helper.ts +++ b/src/utils/Helper.ts @@ -589,7 +589,7 @@ export const updateStoreFromCohorts = (activeCohorts: any, blockObject: any) => const setStateName = manageUserStore.getState().setStateName; - const district = activeCohorts[0]?.customField?.find( + const district = activeCohorts?.[0]?.customField?.find( (item: any) => item?.label === 'DISTRICTS' ); if (district) { @@ -598,7 +598,7 @@ export const updateStoreFromCohorts = (activeCohorts: any, blockObject: any) => setDistrictName(district?.value) } - const state = activeCohorts[0]?.customField?.find( + const state = activeCohorts?.[0]?.customField?.find( (item: any) => item?.label === 'STATES' );