more timeout mess aroundary

This commit is contained in:
erik-sn committed 2020-11-21 10:09:20 -05:00
1 parent 9cccf91a84
commit 8191a9431c
5 files changed
+28 -23

No files matched your search

@@ -27,11 +27,24 @@ export const MessageModal = () => {
};
useEffect(() => {
if (!activeMessageGroup?.groupId) return;
const timeout = window.setTimeout(() => {
setMimimumLoadPassed(true);
}, MINIMUM_LOAD_TIME);
return () => window.clearTimeout(timeout);
});
const interval = window.setInterval(() => {
if (!activeMessageGroup) return;
Nui.send("phone:fetchMessages", {
groupId: activeMessageGroup.groupId,
});
}, MESSAGES_REFRESH_RATE);
return () => {
window.clearInterval(interval);
window.clearTimeout(timeout);
};
}, [activeMessageGroup?.groupId]);
useEffect(() => {
// when we get a new message group we should scroll to the
@@ -44,14 +57,6 @@ export const MessageModal = () => {
}
}, [minimumLoadPassed, messages?.length]);
useEffect(() => {
const interval = window.setInterval(() => {
if (!activeMessageGroup) return;
Nui.send("phone:fetchMessages", { groupId: activeMessageGroup.groupId });
}, MESSAGES_REFRESH_RATE);
return () => window.clearInterval(interval);
});
// we add a minimum (but short) load time here so that
// there isn't a quick flash of loading and immediately
// another flash to the tweets screen.