fix(webui): check for updates only after opening About (#6397)

* fix(webui): check for updates only after opening About

* docs(agent): require meaningful behavioral test assertions
This commit is contained in:
chengyongru authored and GitHub committed 2026-10-22 21:04:21 +08:00
1 parent eceea7b5fb
commit 6ace6068d7
8 files changed
+25 -19

No files matched your search

+1 -3
View File
@@ -29,7 +29,6 @@ export function ClientProvider({
modelName = null,
ingressLimits = null,
webuiCapabilities = [],
checkUpdatesOnConnect = false,
allowUpdateFlow = true,
children,
}: {
@@ -38,7 +37,6 @@ export function ClientProvider({
modelName?: string | null;
ingressLimits?: WebUIIngressLimits | null;
webuiCapabilities?: string[];
checkUpdatesOnConnect?: boolean;
allowUpdateFlow?: boolean;
children: ReactNode;
}) {
@@ -52,7 +50,7 @@ export function ClientProvider({
return (
<ClientContext.Provider value={value}>
<VersionCheckProvider token={token} client={client} autoCheck={checkUpdatesOnConnect}
<VersionCheckProvider token={token} client={client}
channels={allowUpdateFlow && webuiCapabilities.includes("webui.update-channels.v1")}>
<UpdateFlowProvider client={client} token={token} enabled={allowUpdateFlow && webuiCapabilities.includes("webui.update-flow.v1")}
canSettleHandoff={webuiCapabilities.includes("webui.update-jobs.settle-handoff.v1")}>
+2 -8
View File
@@ -1,4 +1,4 @@
import { createContext, useContext, useEffect, useMemo, useSyncExternalStore, type ReactNode } from "react";
import { createContext, useContext, useMemo, useSyncExternalStore, type ReactNode } from "react";
import { checkVersion, changeUpdateChannel, type ReleaseStatus, type UpdateChannel, type UpdateMethod, type WebUIMutationTransport } from "@/lib/api";
@@ -96,9 +96,8 @@ function createVersionCheck(token: string, channels: boolean, client?: WebUIMuta
};
}
export function VersionCheckProvider({ token, autoCheck = false, channels = false, client, children }: {
export function VersionCheckProvider({ token, channels = false, client, children }: {
token: string;
autoCheck?: boolean;
channels?: boolean;
client?: WebUIMutationTransport;
children: ReactNode;
@@ -106,11 +105,6 @@ export function VersionCheckProvider({ token, autoCheck = false, channels = fals
const store = useMemo(() => createVersionCheck(token, channels, client), [token, channels, client]);
const snapshot = useSyncExternalStore(store.subscribe, store.getSnapshot);
useEffect(() => {
// One quiet check on connection, not a timer or an installation request.
if (autoCheck && token) void store.check();
}, [autoCheck, store, token]);
return <VersionCheckContext.Provider value={{ ...snapshot, check: store.check, dismiss: store.dismiss, changeChannel: store.changeChannel }}>
{children}
</VersionCheckContext.Provider>;