Merge pull request #30668 from jandrzejczak/fix-entity-inspector-wiping-search-params
Prevent the entity inspector from overwriting all existing URL search params.
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-catalog': patch
|
||||
---
|
||||
|
||||
Fixed bug in EntityLayout that caused wiping existing query parameters when opening the InspectEntityDialog.
|
||||
@@ -361,7 +361,13 @@ export const EntityLayout = (props: EntityLayoutProps) => {
|
||||
UNSTABLE_extraContextMenuItems={UNSTABLE_extraContextMenuItems}
|
||||
UNSTABLE_contextMenuOptions={UNSTABLE_contextMenuOptions}
|
||||
onUnregisterEntity={() => setConfirmationDialogOpen(true)}
|
||||
onInspectEntity={() => setSearchParams('inspect')}
|
||||
onInspectEntity={() => {
|
||||
setSearchParams(prev => {
|
||||
const newParams = new URLSearchParams(prev);
|
||||
newParams.set('inspect', '');
|
||||
return newParams;
|
||||
});
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
@@ -401,9 +407,21 @@ export const EntityLayout = (props: EntityLayoutProps) => {
|
||||
typeof InspectEntityDialog
|
||||
>['initialTab']) || undefined
|
||||
}
|
||||
onSelect={newTab => setSearchParams(`inspect=${newTab}`)}
|
||||
onSelect={newTab =>
|
||||
setSearchParams(prev => {
|
||||
const newParams = new URLSearchParams(prev);
|
||||
newParams.set('inspect', newTab);
|
||||
return newParams;
|
||||
})
|
||||
}
|
||||
open
|
||||
onClose={() => setSearchParams()}
|
||||
onClose={() =>
|
||||
setSearchParams(prev => {
|
||||
const newParams = new URLSearchParams(prev);
|
||||
newParams.delete('inspect');
|
||||
return newParams;
|
||||
})
|
||||
}
|
||||
/>
|
||||
)}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user