-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: update entity detail page to view entities from other catalogs (#…
…573) (#590) * feat: update entity detail page to view entities from other catalogs (#573) * refactor: catalog response entity (#573) --------- Co-authored-by: Fran McDade <[email protected]>
- Loading branch information
Showing
7 changed files
with
98 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
packages/data-explorer-ui/src/hooks/useUpdateURLCatalogParam.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import Router, { useRouter } from "next/router"; | ||
import { useEffect } from "react"; | ||
import { useExploreState } from "./useExploreState"; | ||
|
||
/** | ||
* Updates URL catalog params. | ||
*/ | ||
export const useUpdateURLCatalogParams = (): void => { | ||
const { exploreState } = useExploreState(); | ||
const { basePath, pathname, query } = useRouter(); | ||
const { catalogState } = exploreState; | ||
|
||
useEffect(() => { | ||
if (!catalogState) return; | ||
if ("catalog" in query && query.catalog === catalogState) return; | ||
Router.replace({ | ||
pathname: pathname?.replace(basePath, ""), | ||
query: { ...query, catalog: catalogState }, | ||
}); | ||
}, [basePath, catalogState, pathname, query]); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters