Skip to content

Commit

Permalink
[Fleet] Fix routing issues with getPath and history.push (#101658)
Browse files Browse the repository at this point in the history
* Fix getPath usage in Fleet app

* Fix pathname in failing test
  • Loading branch information
kpollich authored Jun 9, 2021
1 parent 520d1e8 commit 58eb0d4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,7 @@ describe('when on integration detail', () => {
pagePathGetters.integration_details_custom({ pkgkey: 'nginx-0.3.7' })[1]
);
});
expect(testRenderer.history.location.pathname).toEqual(
'/app/integrations/detail/nginx-0.3.7/overview'
);
expect(testRenderer.history.location.pathname).toEqual('/detail/nginx-0.3.7/overview');
});
});

Expand Down
4 changes: 1 addition & 3 deletions x-pack/plugins/fleet/public/hooks/use_link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ export const useLink = () => {
const core = useStartServices();
return {
getPath: (page: StaticPage | DynamicPage, values: DynamicPagePathValues = {}): string => {
const [basePath, path] = getSeparatePaths(page, values);

return `${basePath}${path}`;
return getSeparatePaths(page, values)[1];
},
getAssetsPath: (path: string) =>
core.http.basePath.prepend(`/plugins/${PLUGIN_ID}/assets/${path}`),
Expand Down

0 comments on commit 58eb0d4

Please sign in to comment.