Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions web/context/provider-context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export const ProviderContextProvider = ({

const [enableEducationPlan, setEnableEducationPlan] = useState(false)
const [isEducationWorkspace, setIsEducationWorkspace] = useState(false)
const { data: educationAccountInfo, isLoading: isLoadingEducationAccountInfo, isFetching: isFetchingEducationAccountInfo } = useEducationStatus(!enableEducationPlan)
const { data: educationAccountInfo, isLoading: isLoadingEducationAccountInfo, isFetching: isFetchingEducationAccountInfo, isFetchedAfterMount: isEducationDataFetchedAfterMount } = useEducationStatus(!enableEducationPlan)
const [isAllowTransferWorkspace, setIsAllowTransferWorkspace] = useState(false)
const [isAllowPublishAsCustomKnowledgePipelineTemplate, setIsAllowPublishAsCustomKnowledgePipelineTemplate] = useState(false)

Expand Down Expand Up @@ -240,9 +240,9 @@ export const ProviderContextProvider = ({
datasetOperatorEnabled,
enableEducationPlan,
isEducationWorkspace,
isEducationAccount: educationAccountInfo?.is_student || false,
allowRefreshEducationVerify: educationAccountInfo?.allow_refresh || false,
educationAccountExpireAt: educationAccountInfo?.expire_at || null,
isEducationAccount: isEducationDataFetchedAfterMount ? (educationAccountInfo?.is_student ?? false) : false,
allowRefreshEducationVerify: isEducationDataFetchedAfterMount ? (educationAccountInfo?.allow_refresh ?? false) : false,
educationAccountExpireAt: isEducationDataFetchedAfterMount ? (educationAccountInfo?.expire_at ?? null) : null,
isLoadingEducationAccountInfo,
isFetchingEducationAccountInfo,
webappCopyrightEnabled,
Expand Down
2 changes: 1 addition & 1 deletion web/service/use-education.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export const useEducationStatus = (disable?: boolean) => {
return get<{ is_student: boolean, allow_refresh: boolean, expire_at: number | null }>('/account/education')
},
retry: false,
gcTime: 0, // No cache. Prevent switch account caused stale data
staleTime: 0, // Data expires immediately, ensuring fresh data on refetch
})
}

Expand Down
Loading