Prevent overwrite with prev state of search params
Signed-off-by: Jordan Andrzejczak <jordan.andrzejczak@outlook.com>
This commit is contained in:
committed by
Jordan Andrzejczak
parent
3ef648c259
commit
5adad5eb9f
@@ -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