Commit d19da468 by Liu

fix:只在sso_login 时调用初始化常见问题接口

parent d2762443
...@@ -262,7 +262,7 @@ export const Home: React.FC = () => { ...@@ -262,7 +262,7 @@ export const Home: React.FC = () => {
window.dispatchEvent(new CustomEvent('forceResetToGeneralMode')) window.dispatchEvent(new CustomEvent('forceResetToGeneralMode'))
initConversation() initConversation()
dispatch(fetchConversations()) dispatch(fetchConversations())
// 登录成功后再拉取一次常见问题,强制 toolId 为空 // sso_login 成功后,首次拉取常见问题,强制 toolId 为空
handleInitialQuestions() handleInitialQuestions()
} }
} }
...@@ -311,8 +311,6 @@ export const Home: React.FC = () => { ...@@ -311,8 +311,6 @@ export const Home: React.FC = () => {
window.dispatchEvent(new CustomEvent('forceResetToGeneralMode')) window.dispatchEvent(new CustomEvent('forceResetToGeneralMode'))
initConversation() initConversation()
dispatch(fetchConversations()) dispatch(fetchConversations())
// 登录成功后再拉取一次常见问题,强制 toolId 为空
handleInitialQuestions()
} }
} }
}, [setToken, dispatch, handleInitialQuestions]) }, [setToken, dispatch, handleInitialQuestions])
...@@ -324,14 +322,8 @@ export const Home: React.FC = () => { ...@@ -324,14 +322,8 @@ export const Home: React.FC = () => {
useEffect(() => { useEffect(() => {
login() login()
// 首页首次挂载时重置为通用模式:
// 1. 清除 Redux 中的 currentToolId
dispatch(clearCurrentToolId()) dispatch(clearCurrentToolId())
// 2. 清除 sessionStorage 中可能残留的 currentToolId,避免沿用上一次工具模式 }, []) // 依赖数组为空,只在组件挂载时执行一次
// sessionStorage.removeItem('currentToolId')
// 3. 首页首次挂载时仅使用空 toolId 拉取常见问题
handleInitialQuestions()
}, [handleInitialQuestions]) // 依赖数组为空,只在组件挂载时执行一次
return ( return (
<div className={styles.homePage}> <div className={styles.homePage}>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment