Add notifications.
This commit is contained in:
+5
-5
@@ -213,7 +213,7 @@ export default function App() {
|
||||
|
||||
// The parsed diff lives here rather than in DiffView because the comments rail
|
||||
// needs it too: deciding which comments the diff can still place is one
|
||||
// judgement, made once, so the rail and the diff can't disagree about it.
|
||||
// judgment, made once, so the rail and the diff can't disagree about it.
|
||||
const parsedFiles = useMemo(() => (payload ? parseDiff(payload.patch) : []), [payload]);
|
||||
|
||||
// What each file's diff currently says, digested. Viewed marks are stored
|
||||
@@ -395,20 +395,20 @@ export default function App() {
|
||||
useEffect(() => {
|
||||
if (!path || !revision || stale) return;
|
||||
|
||||
let cancelled = false;
|
||||
let canceled = false;
|
||||
let busy = false;
|
||||
|
||||
const check = async () => {
|
||||
// A hidden pane is a pane nobody is reading. It gets checked the moment it
|
||||
// comes back instead, which is when the answer matters.
|
||||
if (cancelled || busy || document.hidden) return;
|
||||
if (canceled || busy || document.hidden) return;
|
||||
busy = true;
|
||||
const seq = reqRef.current;
|
||||
try {
|
||||
const { revision: now } = await api.revision(ctx, { ignoreWhitespace: ignoreWs });
|
||||
// A load that started while this was in flight has already answered the
|
||||
// question, with a revision this closure doesn't know about.
|
||||
if (cancelled || seq !== reqRef.current) return;
|
||||
if (canceled || seq !== reqRef.current) return;
|
||||
if (now && now !== revision) setStale(now);
|
||||
} catch {
|
||||
// A failed poll says nothing about the diff — the next one will.
|
||||
@@ -424,7 +424,7 @@ export default function App() {
|
||||
document.addEventListener('visibilitychange', onVisible);
|
||||
window.addEventListener('focus', onVisible);
|
||||
return () => {
|
||||
cancelled = true;
|
||||
canceled = true;
|
||||
window.clearInterval(timer);
|
||||
document.removeEventListener('visibilitychange', onVisible);
|
||||
window.removeEventListener('focus', onVisible);
|
||||
|
||||
Reference in New Issue
Block a user