fixed redirect for extracedresults.

pull/67/head
s8613 2025-06-14 13:36:00 +02:00
parent 940b198003
commit 4a347951e9
3 changed files with 17 additions and 4 deletions

View File

@ -34,6 +34,7 @@ interface KennzahlenTableProps {
source: string; source: string;
}[]; }[];
}; };
from?: string;
} }
export default function KennzahlenTable({ export default function KennzahlenTable({
@ -41,10 +42,11 @@ export default function KennzahlenTable({
data, data,
pdfId, pdfId,
settings, settings,
from
}: KennzahlenTableProps) { }: KennzahlenTableProps) {
const [editingIndex, setEditingIndex] = useState<string>(""); const [editingIndex, setEditingIndex] = useState<string>("");
const [editValue, setEditValue] = useState(""); const [editValue, setEditValue] = useState("");
const navigate = useNavigate({ from: "/extractedResult/$pitchBook" }); const navigate = useNavigate();
const queryClient = useQueryClient(); const queryClient = useQueryClient();
@ -120,6 +122,7 @@ export default function KennzahlenTable({
pitchBook: pdfId, pitchBook: pdfId,
kpi: settingName, kpi: settingName,
}, },
search: { from: from ?? undefined },
}); });
}; };

View File

@ -98,6 +98,7 @@ function ExtractedResultsPage() {
onPageClick={setCurrentPage} onPageClick={setCurrentPage}
data={kpi} data={kpi}
pdfId={pitchBook} pdfId={pitchBook}
from={from}
/> />
</Paper> </Paper>
<Box <Box

View File

@ -27,6 +27,11 @@ import { redirect } from "@tanstack/react-router";
export const Route = createFileRoute("/extractedResult_/$pitchBook/$kpi")({ export const Route = createFileRoute("/extractedResult_/$pitchBook/$kpi")({
component: ExtractedResultsPage, component: ExtractedResultsPage,
validateSearch: (search: Record<string, unknown>) => {
return {
from: typeof search.from === "string" ? search.from : undefined,
};
},
loader: async ({ context: { queryClient }, params: { pitchBook } }) => { loader: async ({ context: { queryClient }, params: { pitchBook } }) => {
try { try {
return await queryClient.ensureQueryData(kpiQueryOptions(pitchBook)); return await queryClient.ensureQueryData(kpiQueryOptions(pitchBook));
@ -43,6 +48,7 @@ function ExtractedResultsPage() {
const { pitchBook, kpi } = params; const { pitchBook, kpi } = params;
const navigate = useNavigate(); const navigate = useNavigate();
const queryClient = useQueryClient(); const queryClient = useQueryClient();
const { from } = Route.useSearch();
const { const {
data: kpiData data: kpiData
@ -76,7 +82,8 @@ function ExtractedResultsPage() {
}); });
navigate({ navigate({
to: "/extractedResult/$pitchBook", to: "/extractedResult/$pitchBook",
params: { pitchBook } params: { pitchBook },
search: from ? { from } : undefined
}); });
}, },
onError: (error) => { onError: (error) => {
@ -112,7 +119,8 @@ function ExtractedResultsPage() {
} else { } else {
navigate({ navigate({
to: "/extractedResult/$pitchBook", to: "/extractedResult/$pitchBook",
params: { pitchBook } params: { pitchBook },
search: from ? { from } : undefined
}); });
} }
}; };
@ -121,7 +129,8 @@ function ExtractedResultsPage() {
setShowConfirmDialog(false); setShowConfirmDialog(false);
navigate({ navigate({
to: "/extractedResult/$pitchBook", to: "/extractedResult/$pitchBook",
params: { pitchBook } params: { pitchBook },
search: from ? { from } : undefined
}); });
}; };