fix: refresh UI after user profile change (#24998)

This commit is contained in:
17hz
2025-09-02 18:57:35 +08:00
committed by GitHub
parent 32972b45db
commit 5aa8c9c8df

View File

@@ -86,10 +86,9 @@ export const AppContextProvider: FC<AppContextProviderProps> = ({ children }) =>
const isCurrentWorkspaceEditor = useMemo(() => ['owner', 'admin', 'editor'].includes(currentWorkspace.role), [currentWorkspace.role])
const isCurrentWorkspaceDatasetOperator = useMemo(() => currentWorkspace.role === 'dataset_operator', [currentWorkspace.role])
const updateUserProfileAndVersion = useCallback(async () => {
if (userProfileResponse) {
if (userProfileResponse && !userProfileResponse.bodyUsed) {
try {
const clonedResponse = (userProfileResponse as Response).clone()
const result = await clonedResponse.json()
const result = await userProfileResponse.json()
setUserProfile(result)
const current_version = userProfileResponse.headers.get('x-version')
const current_env = process.env.NODE_ENV === 'development' ? 'DEVELOPMENT' : userProfileResponse.headers.get('x-env')