Skip to content

Commit

Permalink
Include search params in edit next URL when coming from list (#1318)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohamed-Hacene authored Jan 7, 2025
2 parents 6d86023 + 8c80046 commit e1d9807
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions frontend/src/lib/components/Breadcrumbs/Breadcrumbs.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
breadcrumbs: Breadcrumb[],
currentPath: string
): Promise<Breadcrumb[]> {
const idx = breadcrumbs.findIndex((c) => c.href === currentPath);
if (idx >= 0 && idx < breadcrumbs.length - 1) {
const idx = breadcrumbs.findIndex((c) => c.href?.startsWith(currentPath));
// First breadcrumb is home, its href is always '/'
if (idx > 0 && idx < breadcrumbs.length - 1) {
breadcrumbs = breadcrumbs.slice(0, idx + 1);
}
return breadcrumbs;
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/lib/components/ModelTable/ModelTable.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@
URLModel={actionsURLModel}
detailURL={`/${actionsURLModel}/${row.meta[identifierField]}${detailQueryParameter}`}
editURL={!(row.meta.builtin || row.meta.urn)
? `/${actionsURLModel}/${row.meta[identifierField]}/edit?next=${$page.url.pathname}`
? `/${actionsURLModel}/${row.meta[identifierField]}/edit?next=${encodeURIComponent($page.url.pathname + $page.url.search)}`
: undefined}
{row}
hasBody={$$slots.actionsBody}
Expand Down

0 comments on commit e1d9807

Please sign in to comment.