chore: updates
This commit is contained in:
Vendored
+1
-1
@@ -53,7 +53,7 @@ const tables = [
|
||||
];
|
||||
const initCache = () => {
|
||||
const uid = localStorage.getItem(KEY_UID) || "";
|
||||
// 没有uid,就没有本地缓存
|
||||
// 没有 uid,就没有本地缓存
|
||||
if (!uid) return;
|
||||
const name = `local_db_${uid}_v_${CACHE_VERSION.split(".").join("_")}`;
|
||||
window.CACHE = {};
|
||||
|
||||
@@ -88,12 +88,12 @@ export default function useStreaming() {
|
||||
console.info("debug SSE: start new timeout", aliveInter);
|
||||
};
|
||||
const startStreaming = useCallback(async () => {
|
||||
console.info("debug SSE: clear timeout at startStreaming", aliveInter);
|
||||
clearTimeout(aliveInter);
|
||||
if (SSE && (SSE.readyState === EventSource.OPEN || SSE.readyState === EventSource.CONNECTING)) {
|
||||
console.info("debug SSE: SSE not disconnect");
|
||||
return;
|
||||
}
|
||||
// stop first
|
||||
stopStreaming();
|
||||
// if (SSE && (SSE.readyState === EventSource.OPEN || SSE.readyState === EventSource.CONNECTING)) {
|
||||
// console.info("debug SSE: SSE not disconnect");
|
||||
// return;
|
||||
// }
|
||||
const { token, refreshToken, expireTime } = getLocalAuthData();
|
||||
// token 非空
|
||||
if (!token) {
|
||||
@@ -107,10 +107,10 @@ export default function useStreaming() {
|
||||
if ("error" in resp) {
|
||||
console.error("renew error from sse", resp.error);
|
||||
// 还有网,而且在当前页,则停止循环
|
||||
const tabHidden = isTabHidden();
|
||||
if (navigator.onLine || !tabHidden) {
|
||||
stopStreaming();
|
||||
}
|
||||
// const tabHidden = isTabHidden();
|
||||
// if (navigator.onLine || !tabHidden) {
|
||||
// stopStreaming();
|
||||
// }
|
||||
// 返回,开始下次 polling(如果有)
|
||||
return;
|
||||
} else {
|
||||
|
||||
@@ -19,7 +19,7 @@ type Props = {
|
||||
|
||||
const Index = ({ handleClose, hostId }: Props) => {
|
||||
const { embed, inviteOnly } = useWidget();
|
||||
// 建立SSE连接
|
||||
// 建立 SSE 连接
|
||||
useSSE();
|
||||
const loginUser = useAppSelector((store) => store.authData.user, shallowEqual);
|
||||
const token = useAppSelector((store) => store.authData.token, shallowEqual);
|
||||
|
||||
@@ -15,7 +15,7 @@ function Widget({ hostId }: Props) {
|
||||
const [visible, setVisible] = useState(!!new URLSearchParams(location.search).get("open"));
|
||||
|
||||
const toggleVisible = () => {
|
||||
// 有无iframe内嵌
|
||||
// 有无 iframe 内嵌
|
||||
const parentWindow = window.parent;
|
||||
if (parentWindow) {
|
||||
parentWindow.postMessage(visible ? "CLOSE" : "OPEN", "*");
|
||||
|
||||
Reference in New Issue
Block a user