feat(web): user memory feature optimize

This commit is contained in:
zhaoying
2026-01-22 12:26:37 +08:00
parent 783593a79d
commit da75abb223
9 changed files with 75 additions and 34 deletions

View File

@@ -20,14 +20,22 @@ const ImplicitDetail = forwardRef<{ handleRefresh: () => void; }>((_props, ref)
const habitsRef = useRef<{ handleRefresh: () => void; }>(null)
const handleRefresh = () => {
if (!id) return
generateProfile(id)
.then(() => {
preferencesRef.current?.handleRefresh()
portraitRef.current?.handleRefresh()
interestAreasRef.current?.handleRefresh()
habitsRef.current?.handleRefresh()
})
if (!id) {
return Promise.resolve()
}
return new Promise((resolve, reject) => {
generateProfile(id)
.then(() => {
preferencesRef.current?.handleRefresh()
portraitRef.current?.handleRefresh()
interestAreasRef.current?.handleRefresh()
habitsRef.current?.handleRefresh()
resolve(true)
})
.catch((error) => {
reject(error)
})
})
}
useImperativeHandle(ref, () => ({
handleRefresh