fix: stay on 'verify' tab after mark a verify step as done

This commit is contained in:
tigerenwork 2026-02-05 18:14:52 +08:00
parent 55060cd5b7
commit b66fec5075
2 changed files with 18 additions and 8 deletions

View File

@ -16,6 +16,9 @@ interface ReleaseDetailPageProps {
params: Promise<{
id: string;
}>;
searchParams: Promise<{
tab?: string;
}>;
}
const typeColors: Record<string, string> = {
@ -40,10 +43,12 @@ function getStatusColor(status: string) {
export const dynamic = 'force-dynamic';
export default async function ReleaseDetailPage({ params }: ReleaseDetailPageProps) {
export default async function ReleaseDetailPage({ params, searchParams }: ReleaseDetailPageProps) {
const { id } = await params;
const { tab } = await searchParams;
const releaseId = parseInt(id);
const release = await getReleaseById(releaseId);
const activeTab = tab === 'verify' ? 'verify' : 'deploy';
if (!release) {
notFound();
@ -186,13 +191,17 @@ export default async function ReleaseDetailPage({ params }: ReleaseDetailPagePro
{/* Matrix View (for active) */}
{release.status === 'active' && (
<Tabs defaultValue="deploy">
<Tabs defaultValue={activeTab}>
<TabsList>
<TabsTrigger value="deploy">
Deploy ({stats.done + stats.skipped}/{stats.total})
<TabsTrigger value="deploy" asChild>
<Link href={`/releases/${releaseId}?tab=deploy`}>
Deploy ({stats.done + stats.skipped}/{stats.total})
</Link>
</TabsTrigger>
<TabsTrigger value="verify">
Verify
<TabsTrigger value="verify" asChild>
<Link href={`/releases/${releaseId}?tab=verify`}>
Verify
</Link>
</TabsTrigger>
</TabsList>

View File

@ -45,8 +45,9 @@ export function ReleaseMatrixClient({ stepsByCluster, category, releaseId }: Rel
const handleActionComplete = () => {
setRefreshKey(prev => prev + 1);
setIsPanelOpen(false);
// Refresh the page to get updated data
window.location.reload();
// Refresh the page to get updated data, preserving the current tab
const currentUrl = new URL(window.location.href);
window.location.href = currentUrl.toString();
};
// Server actions wrapped in async functions