Dynamic URL that mirros interlex urls + optimizations#118
Merged
Conversation
…nd replaced in favour of the dynamic groupname
jrmartin
requested changes
Jul 14, 2025
|
|
||
| const handleGoToTermClick = () => { | ||
| navigate(`/view?searchTerm=${newTermId}`); | ||
| navigate(`/base/${newTermId}/overview`); |
There was a problem hiding this comment.
@ddelpiano Should it be the username here instead of base?
There was a problem hiding this comment.
Pull Request Overview
This PR enhances URL routing to include dynamic user group segments, implements fallback logic for API requests, and applies memoization and callbacks across term views to optimize performance.
- Updated routing and navigation to use
:groupURL parameter and dynamicgroupNamefrom user context. - Refactored
SingleTermViewto use URL params, optimized data fetching with caching and fallback, and replaced query-based logic. - Extended API service methods (
getSelectedTermLabel,getMatchTerms,getRawData) with fallback to the ‘base’ group and enriched error handling.
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| AddNewTermDialogContent.jsx | Added user context and updated navigation to include groupName. |
| SingleTermView/index.jsx | Refactored component to use URL params, dynamic grouping, caching, and memoized handlers. |
| OverView/OverView.jsx | Added group prop support in data fetch calls and propTypes. |
| SearchResults/ListView.jsx | Replaced static /view links with dynamic group-based URLs. |
| Header/index.jsx | Updated user nav menu to generate group-aware dashboard link. |
| Header/Search.jsx | Updated search navigation to include dynamic group segments. |
| GraphViewer/GraphStructure.jsx | Added clarifying comments in object-predicate logic. |
| api/endpoints/apiService.ts | Introduced fallback logic for API calls across all group-based endpoints. |
| App.jsx | Modified routes to include :group param for search, dashboard, and term views. |
Comments suppressed due to low confidence (5)
src/components/Header/index.jsx:167
- The "Log out" menu item lacks an
hrefor click handler to perform the logout action. Consider adding a proper navigation path or onClick callback so users can actually log out.
label: 'Log out',
src/components/SingleTermView/index.jsx:228
- [nitpick] The variable name
isItForkis unclear. Consider renaming it to something likeisForkedorisExternalForkfor better readability.
const isItFork = actualGroup === 'base' ? false : true; // Use actualGroup instead of group
src/api/endpoints/apiService.ts:87
- You’ve introduced fallback logic for non-‘base’ groups here. It would be helpful to add unit tests covering both successful and fallback request scenarios to ensure correct behavior.
if (group !== 'base') {
src/components/Header/index.jsx:157
useris referenced here but not defined in this scope. You need to addconst { user } = useContext(GlobalDataContext);and importGlobalDataContextat the top of this component.
return user?.groupname || 'base';
src/components/SingleTermView/OverView/OverView.jsx:25
- [nitpick] This
console.logappears to be a leftover debug statement. Remove it or replace with proper logging if needed to reduce noise in production.
console.log("data from api call: ", data)
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.