mirror of
https://github.com/Studio-Saelix/sencho.git
synced 2026-08-18 14:33:19 +00:00
fix: dashboard cards and stacks list do not update on remote node switch
- HomeDashboard: both polling useEffects now depend on activeNode?.id so intervals restart and stale local-node data is cleared immediately on node switch; added res.ok guard before calling res.json() to prevent error objects being written into stats/systemStats state - EditorLayout: refreshStacks now guards res.ok before parsing the JSON body and iterates a typed fileList instead of the raw response value, preventing SyntaxError/TypeError when proxy returns a non-JSON response for an unreachable remote node
This commit is contained in:
@@ -123,12 +123,17 @@ export default function EditorLayout() {
|
||||
if (!background) setIsLoading(true);
|
||||
try {
|
||||
const res = await apiFetch('/stacks');
|
||||
const stacks = await res.json();
|
||||
setFiles(Array.isArray(stacks) ? stacks : []);
|
||||
if (!res.ok) {
|
||||
setFiles([]);
|
||||
return;
|
||||
}
|
||||
const data = await res.json();
|
||||
const fileList: string[] = Array.isArray(data) ? data : [];
|
||||
setFiles(fileList);
|
||||
|
||||
// Fetch status for each stack
|
||||
const statuses: StackStatus = {};
|
||||
for (const file of stacks) {
|
||||
for (const file of fileList) {
|
||||
try {
|
||||
const containersRes = await apiFetch(`/stacks/${file}/containers`);
|
||||
const containers = await containersRes.json();
|
||||
|
||||
Reference in New Issue
Block a user