From 36e28aba99178a4b9c018a0fbea0be87e9f93739 Mon Sep 17 00:00:00 2001 From: Evgenii Alekseev Date: Tue, 21 Jul 2026 10:44:20 +0300 Subject: [PATCH] fix: always load tab on remount it fixes a bug, which leads to missing tab content load when opening package info --- .../components/dialogs/PackageInfoDialog.tsx | 36 +++++++++---------- .../src/components/package/ArtifactsTab.tsx | 5 +-- .../src/components/package/BuildLogsTab.tsx | 2 ++ frontend/src/components/package/EventsTab.tsx | 1 + frontend/src/hooks/usePackageChanges.ts | 1 + 5 files changed, 25 insertions(+), 20 deletions(-) diff --git a/frontend/src/components/dialogs/PackageInfoDialog.tsx b/frontend/src/components/dialogs/PackageInfoDialog.tsx index 0a608596..fb0957b4 100644 --- a/frontend/src/components/dialogs/PackageInfoDialog.tsx +++ b/frontend/src/components/dialogs/PackageInfoDialog.tsx @@ -58,11 +58,7 @@ export default function PackageInfoDialog({ const { showSuccess, showError } = useNotification(); const queryClient = useQueryClient(); - const [localPackageBase, setLocalPackageBase] = useState(packageBase); - if (packageBase !== null && packageBase !== localPackageBase) { - setLocalPackageBase(packageBase); - } - + const localPackageBase = packageBase; const [activeTab, setActiveTab] = useState("logs"); const [refreshDatabase, setRefreshDatabase] = useState(true); @@ -157,38 +153,42 @@ export default function PackageInfoDialog({ {pkg && - <> - - void handleDeletePatch(key)} - patches={patches} - /> + + } + {localPackageBase && + void handleDeletePatch(key)} + patches={patches} + /> + } + {localPackageBase && currentRepository && + <> setActiveTab(tab)} value={activeTab}> {tabs.map(({ key, label }) => )} - {activeTab === "logs" && localPackageBase && currentRepository && + {activeTab === "logs" && } - {activeTab === "changes" && localPackageBase && currentRepository && + {activeTab === "changes" && } - {activeTab === "pkgbuild" && localPackageBase && currentRepository && + {activeTab === "pkgbuild" && } - {activeTab === "events" && localPackageBase && currentRepository && + {activeTab === "events" && } - {activeTab === "artifacts" && localPackageBase && currentRepository && + {activeTab === "artifacts" && diff --git a/frontend/src/components/package/ArtifactsTab.tsx b/frontend/src/components/package/ArtifactsTab.tsx index e9a326ac..1d645801 100644 --- a/frontend/src/components/package/ArtifactsTab.tsx +++ b/frontend/src/components/package/ArtifactsTab.tsx @@ -32,7 +32,7 @@ import { useCallback, useMemo } from "react"; import { DETAIL_TABLE_PROPS } from "utils"; interface ArtifactsTabProps { - currentVersion: string; + currentVersion?: string; packageBase: string; repository: RepositoryId; } @@ -78,6 +78,7 @@ export default function ArtifactsTab({ })).reverse(); }, queryKey: QueryKeys.artifacts(packageBase, repository), + refetchOnMount: "always", }); const handleRollback = useCallback(async (version: string): Promise => { @@ -101,7 +102,7 @@ export default function ArtifactsTab({ void handleRollback(params.row.version)} size="small" > diff --git a/frontend/src/components/package/BuildLogsTab.tsx b/frontend/src/components/package/BuildLogsTab.tsx index 4f4fe56a..92134028 100644 --- a/frontend/src/components/package/BuildLogsTab.tsx +++ b/frontend/src/components/package/BuildLogsTab.tsx @@ -61,6 +61,7 @@ export default function BuildLogsTab({ enabled: !!packageBase, queryFn: () => client.fetch.fetchPackageLogs(packageBase, repository), queryKey: QueryKeys.logs(packageBase, repository), + refetchOnMount: "always", }); // Build version selectors from all logs @@ -116,6 +117,7 @@ export default function BuildLogsTab({ ) : skipToken, queryKey: QueryKeys.logsVersion(packageBase, repository, activeVersion?.version ?? "", activeVersion?.processId ?? ""), + refetchOnMount: "always", }); // Derive displayed logs: prefer fresh polled data when available diff --git a/frontend/src/components/package/EventsTab.tsx b/frontend/src/components/package/EventsTab.tsx index 818f77f0..39fdf8f2 100644 --- a/frontend/src/components/package/EventsTab.tsx +++ b/frontend/src/components/package/EventsTab.tsx @@ -54,6 +54,7 @@ export default function EventsTab({ packageBase, repository }: EventsTabProps): enabled: !!packageBase, queryFn: () => client.fetch.fetchPackageEvents(repository, packageBase, 30), queryKey: QueryKeys.events(repository, packageBase), + refetchOnMount: "always", }); const rows = useMemo(() => events.map((event, index) => ({ diff --git a/frontend/src/hooks/usePackageChanges.ts b/frontend/src/hooks/usePackageChanges.ts index 5d31727b..8c2251f7 100644 --- a/frontend/src/hooks/usePackageChanges.ts +++ b/frontend/src/hooks/usePackageChanges.ts @@ -30,6 +30,7 @@ export function usePackageChanges(packageBase: string, repository: RepositoryId) enabled: !!packageBase, queryFn: () => client.fetch.fetchPackageChanges(packageBase, repository), queryKey: QueryKeys.changes(packageBase, repository), + refetchOnMount: "always", }); return data;