mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-18 13:35:42 +09:00
fix(app): distrust windows loaded across a connection gap (#2574)
This commit is contained in:
1 parent
24b84c419c
commit
fd6ae4abd7
15 files changed
+186
-32
No files matched your search
@@ -71,6 +71,8 @@ import type React from 'react';
|
||||
import {useCallback, useEffect, useMemo, useRef, useState} from 'react';
|
||||
|
||||
const TAIL_PROBE_MAX_ATTEMPTS = 2;
|
||||
const TAIL_PROBE_MIN_INTERVAL_MS = 10_000;
|
||||
const tailProbeAttemptedAt = new Map<string, number>();
|
||||
|
||||
const MESSAGE_LIST_FOR_DESCRIPTOR = msg({
|
||||
message: 'Message list for {channelName}',
|
||||
@@ -483,7 +485,12 @@ export const Messages = observer(function Messages({
|
||||
if (selectedChannelId !== channel.id || tailProbeKeyRef.current === tailProbeKey) {
|
||||
return;
|
||||
}
|
||||
const lastAttemptAt = tailProbeAttemptedAt.get(tailProbeKey);
|
||||
if (lastAttemptAt != null && Date.now() - lastAttemptAt < TAIL_PROBE_MIN_INTERVAL_MS) {
|
||||
return;
|
||||
}
|
||||
tailProbeKeyRef.current = tailProbeKey;
|
||||
tailProbeAttemptedAt.set(tailProbeKey, Date.now());
|
||||
void MessageCommands.fetchMessages(channel.id, null, tailProbeMessageId, MAX_MESSAGES_PER_CHANNEL, undefined, {
|
||||
tailProbe: {
|
||||
watermarkMessageId: tailWatermarkMessageId,
|
||||
|
||||
Reference in new issue
Block a user