mirror of
https://github.com/vitalityAI/office.git
synced 2025-04-19 02:20:17 -04:00
transfer ui bug with cycle
This commit is contained in:
parent
7a5c73bad6
commit
ea3d118d54
|
@ -28,6 +28,7 @@ const Demo: NextPage<any> = ({ officers }) => {
|
||||||
const [input, setInput] = useState({
|
const [input, setInput] = useState({
|
||||||
phone: '',
|
phone: '',
|
||||||
})
|
})
|
||||||
|
const focusSessionMsgInterval = useRef(null);
|
||||||
const [sessions, setSessions] = useState([])
|
const [sessions, setSessions] = useState([])
|
||||||
const [loadingSummary, setLoadingSummary] = useState(false)
|
const [loadingSummary, setLoadingSummary] = useState(false)
|
||||||
const [focusSession, setFocusSession] = useState(null)
|
const [focusSession, setFocusSession] = useState(null)
|
||||||
|
@ -94,6 +95,7 @@ const Demo: NextPage<any> = ({ officers }) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const closePop = async () => {
|
const closePop = async () => {
|
||||||
|
clearInterval(focusSessionMsgInterval.current);
|
||||||
setFocusSession(null)
|
setFocusSession(null)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,13 +108,7 @@ const Demo: NextPage<any> = ({ officers }) => {
|
||||||
if (focusSession) {
|
if (focusSession) {
|
||||||
if (!focusSession.messages) {
|
if (!focusSession.messages) {
|
||||||
await fetcher();
|
await fetcher();
|
||||||
const cycle = () => setTimeout(async () => {
|
focusSessionMsgInterval.current = setInterval(fetcher, updateDelay)
|
||||||
if (focusSession) {
|
|
||||||
await fetcher()
|
|
||||||
cycle()
|
|
||||||
}
|
|
||||||
}, updateDelay)
|
|
||||||
cycle()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user