chore: updates
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "vocechat-web",
|
"name": "vocechat-web",
|
||||||
"version": "0.7.5",
|
"version": "0.7.6",
|
||||||
"homepage": "https://voce.chat",
|
"homepage": "https://voce.chat",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@metamask/onboarding": "^1.0.1",
|
"@metamask/onboarding": "^1.0.1",
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ import {
|
|||||||
import { getLocalAuthData, isElectronContext } from "@/utils";
|
import { getLocalAuthData, isElectronContext } from "@/utils";
|
||||||
import chatMessageHandler from "./chat.handler";
|
import chatMessageHandler from "./chat.handler";
|
||||||
import { shallowEqual } from "react-redux";
|
import { shallowEqual } from "react-redux";
|
||||||
|
import { useLocation } from "react-router-dom";
|
||||||
|
|
||||||
const getQueryString = (params: { [key: string]: string }) => {
|
const getQueryString = (params: { [key: string]: string }) => {
|
||||||
const sp = new URLSearchParams();
|
const sp = new URLSearchParams();
|
||||||
@@ -68,6 +69,7 @@ export default function useStreaming() {
|
|||||||
const readUsers = useAppSelector((store) => store.footprint.readUsers, shallowEqual);
|
const readUsers = useAppSelector((store) => store.footprint.readUsers, shallowEqual);
|
||||||
const readChannels = useAppSelector((store) => store.footprint.readChannels, shallowEqual);
|
const readChannels = useAppSelector((store) => store.footprint.readChannels, shallowEqual);
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
|
const { pathname } = useLocation();
|
||||||
const loginUid = user?.uid || 0;
|
const loginUid = user?.uid || 0;
|
||||||
|
|
||||||
const keepAlive = (timeout?: number) => {
|
const keepAlive = (timeout?: number) => {
|
||||||
@@ -452,13 +454,16 @@ export default function useStreaming() {
|
|||||||
// const timeSpan = 60;
|
// const timeSpan = 60;
|
||||||
const timeSpan = 24 * 60 * 60;
|
const timeSpan = 24 * 60 * 60;
|
||||||
// const timeSpan = 5;
|
// const timeSpan = 5;
|
||||||
const canReconnect = elapsedTime > timeSpan || !SSE;
|
const canReconnect = !guest && (elapsedTime > timeSpan || !SSE) && pathname !== "/login";
|
||||||
|
// const canReconnect = (elapsedTime > timeSpan || !SSE) && pathname !== "/login";
|
||||||
console.info(
|
console.info(
|
||||||
"debug SSE: visibility changed elapsedTime",
|
"debug SSE: visibility changed elapsedTime",
|
||||||
elapsedTime,
|
elapsedTime,
|
||||||
|
pathname,
|
||||||
hiddenTime,
|
hiddenTime,
|
||||||
canReconnect,
|
canReconnect,
|
||||||
!SSE
|
!SSE,
|
||||||
|
guest
|
||||||
);
|
);
|
||||||
// 超过 1 天或者已断线,强制重连
|
// 超过 1 天或者已断线,强制重连
|
||||||
if (canReconnect) {
|
if (canReconnect) {
|
||||||
@@ -474,6 +479,7 @@ export default function useStreaming() {
|
|||||||
}, 1500);
|
}, 1500);
|
||||||
} else {
|
} else {
|
||||||
// 直接重连
|
// 直接重连
|
||||||
|
console.info("debug SSE: stop directly and reconnect");
|
||||||
startStreaming();
|
startStreaming();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user