fix(webui): refine mobile actions and avoid duplicate settings loads

This commit is contained in:
chengyongru authored and chengyongru committed 2026-09-24 23:32:22 +08:00
1 parent f8d655d612
commit c370e2a5a5
6 files changed
+50 -8

No files matched your search

+7
View File
@@ -1175,6 +1175,7 @@ function Shell({
const skills = useSkills(getToken);
const pageVisible = usePageVisibility();
const [settingsSnapshot, setSettingsSnapshot] = useState<SettingsPayload | null>(null);
const [settingsLoading, setSettingsLoading] = useState(true);
const settingsRefreshGenerationRef = useRef(0);
const [pendingAutomationMessage, setPendingAutomationMessage] = useState<{
id: string;
@@ -1298,6 +1299,7 @@ function Shell({
useEffect(() => {
let cancelled = false;
const requestGeneration = settingsRefreshGenerationRef.current;
setSettingsLoading(true);
fetchSettings(getToken())
.then((payload) => {
if (!cancelled && requestGeneration === settingsRefreshGenerationRef.current) {
@@ -1308,6 +1310,9 @@ function Shell({
if (!cancelled && requestGeneration === settingsRefreshGenerationRef.current) {
setSettingsSnapshot(null);
}
})
.finally(() => {
if (!cancelled) setSettingsLoading(false);
});
return () => {
cancelled = true;
@@ -2906,6 +2911,7 @@ function Shell({
workspaceError={workspaceError}
onWorkspaceScopeChange={applyWorkspaceScope}
settingsSnapshot={settingsSnapshot}
settingsLoading={settingsLoading}
onOpenModelSettings={onOpenModelSettings}
skills={skills}
/>
@@ -2968,6 +2974,7 @@ function Shell({
client.setWorkspaceScope(paneSession.chatId, next);
}}
settingsSnapshot={settingsSnapshot}
settingsLoading={settingsLoading}
onOpenModelSettings={onOpenModelSettings}
skills={skills}
/>