chore(deps): lock file maintenance npm dependencies (#6015)

* chore(deps): lock file maintenance npm dependencies

* chore(deps): bump npm deps

* chore: fix eslint ref-name

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Slinetrac <realakayuki@gmail.com>
This commit is contained in:
renovate[bot]
2026-01-05 13:53:22 +08:00
committed by GitHub
co-authored by renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Slinetrac
parent 256a3f697b
commit 2128e1f788
8 changed files with 348 additions and 1460 deletions
+4 -4
View File
@@ -3,12 +3,12 @@ import { listen, UnlistenFn, EventCallback } from "@tauri-apps/api/event";
import { useCallback, useRef } from "react";
export const useListen = () => {
const unlistenFns = useRef<UnlistenFn[]>([]);
const unlistenFnsRef = useRef<UnlistenFn[]>([]);
const addListener = useCallback(
async <T>(eventName: string, handler: EventCallback<T>) => {
const unlisten = await listen(eventName, handler);
unlistenFns.current.push(unlisten);
unlistenFnsRef.current.push(unlisten);
return unlisten;
},
[],
@@ -17,7 +17,7 @@ export const useListen = () => {
const removeAllListeners = useCallback(() => {
const errors: Error[] = [];
unlistenFns.current.forEach((unlisten) => {
unlistenFnsRef.current.forEach((unlisten) => {
try {
unlisten();
} catch (error) {
@@ -32,7 +32,7 @@ export const useListen = () => {
);
}
unlistenFns.current.length = 0;
unlistenFnsRef.current.length = 0;
}, []);
const setupCloseListener = useCallback(async () => {
+4 -4
View File
@@ -109,19 +109,19 @@ export const useLogData = () => {
},
});
const previousLogLevel = useRef<string | undefined>(undefined);
const previousLogLevelRef = useRef<string | undefined>(undefined);
useEffect(() => {
if (!logLevel) {
previousLogLevel.current = logLevel ?? undefined;
previousLogLevelRef.current = logLevel ?? undefined;
return;
}
if (previousLogLevel.current === logLevel) {
if (previousLogLevelRef.current === logLevel) {
return;
}
previousLogLevel.current = logLevel;
previousLogLevelRef.current = logLevel;
refresh();
}, [logLevel, refresh]);
+4 -4
View File
@@ -46,7 +46,7 @@ export const useMihomoWsSubscription = <T>(
const subscriptionCacheKey = subscriptKey ? `$sub$${subscriptKey}` : null;
const wsRef = useRef<MihomoWebSocket | null>(null);
const wsFirstConnection = useRef<boolean>(true);
const wsFirstConnectionRef = useRef<boolean>(true);
const timeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);
const response = useSWRSubscription<T, any, string | null>(
@@ -124,15 +124,15 @@ export const useMihomoWsSubscription = <T>(
}
}
if (wsFirstConnection.current || !wsRef.current) {
wsFirstConnection.current = false;
if (wsFirstConnectionRef.current || !wsRef.current) {
wsFirstConnectionRef.current = false;
cleanupAll();
void connectWs();
}
return () => {
isMounted = false;
wsFirstConnection.current = true;
wsFirstConnectionRef.current = true;
cleanupAll();
};
},