Skip to content

Commit

Permalink
[SECURITY_SOLUTION] Fix URL params being carried across to URL routes…
Browse files Browse the repository at this point in the history
… for which they do not apply (#80726)

* Fix URL params issue on Admin section
* Fix route location state being dropped during updates to other route properties
  • Loading branch information
paul-tavares authored Oct 22, 2020
1 parent 6472caa commit a91fbae
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ export const replaceStateInLocation = <T>({
replaceStateKeyInQueryString(urlStateKey, urlStateToReplace)(getQueryStringFromLocation(search))
);
if (history) {
newLocation.state = history.location.state;
history.replace(newLocation);
}
return newLocation.search;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import deepEqual from 'fast-deep-equal';

import { SpyRouteProps } from './types';
import { useRouteSpy } from './use_route_spy';
import { SecurityPageName } from '../../../../common/constants';

export const SpyRouteComponent = memo<
SpyRouteProps & { location: H.Location; pageName: string | undefined }
Expand Down Expand Up @@ -50,6 +51,7 @@ export const SpyRouteComponent = memo<
pathName: pathname,
state,
tabName,
...(pageName === SecurityPageName.administration ? { search: search ?? '' } : {}),
},
});
setIsInitializing(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ export const TrustedAppsPage = memo(() => {
return <BackToExternalAppButton {...routeState} />;
}
return null;
// FIXME: Route state is being deleted by some parent component
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
}, [routeState]);

const addButton = (
<EuiButton
Expand Down

0 comments on commit a91fbae

Please sign in to comment.