fix(triage): queue folds closed again with animation; deck follows changes from other devices
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
508717cc02
commit
597b6816a7
5 files changed
+77
-39
No files matched your search
+18
-2
@@ -628,8 +628,20 @@ export const App: React.FC = () => {
|
||||
}, 5000);
|
||||
}, []);
|
||||
|
||||
// Refresh stats on task/doc/list real-time events (counters in the navigation)
|
||||
// Refresh stats on task/doc/list real-time events (counters in the navigation). Task events also
|
||||
// reload the triage deck: a note sorted on another device must leave this deck too.
|
||||
useEffect(() => {
|
||||
let deckTimer: number | undefined;
|
||||
const reloadDeck = () => {
|
||||
window.clearTimeout(deckTimer);
|
||||
deckTimer = window.setTimeout(() => {
|
||||
api.getTriageDeck().then((res) => setDeck(Array.isArray(res) ? res : [])).catch(() => {});
|
||||
}, 300);
|
||||
};
|
||||
// Events missed while the tab slept (desktop in the background, connection dropped)
|
||||
const onVisible = () => {
|
||||
if (document.visibilityState === 'visible' && getToken()) refreshAll();
|
||||
};
|
||||
const handleWs = (e: any) => {
|
||||
const msg = e.detail;
|
||||
if (!msg) return;
|
||||
@@ -644,13 +656,17 @@ export const App: React.FC = () => {
|
||||
api.getMe().then((res) => {
|
||||
setStats(res.stats);
|
||||
}).catch(() => {});
|
||||
if (msg.event.startsWith('TASK_')) reloadDeck();
|
||||
}
|
||||
};
|
||||
window.addEventListener('mindsift:ws', handleWs);
|
||||
document.addEventListener('visibilitychange', onVisible);
|
||||
return () => {
|
||||
window.clearTimeout(deckTimer);
|
||||
window.removeEventListener('mindsift:ws', handleWs);
|
||||
document.removeEventListener('visibilitychange', onVisible);
|
||||
};
|
||||
}, []);
|
||||
}, [refreshAll]);
|
||||
|
||||
// Close profile dropdown on outside click
|
||||
useEffect(() => {
|
||||
|
||||
Reference in new issue
Block a user