-
Notifications
You must be signed in to change notification settings - Fork 605
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix topology view updates on search and item select #6033
Fix topology view updates on search and item select #6033
Conversation
@jeff-phillips-18 can we use react-router |
f7e622c
to
d337eca
Compare
const selectId = queryParams.get('selectId'); | ||
const selectTab = queryParams.get('selectTab'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
queryParams
should be a dependency.
We should remove the comment // eslint-disable-next-line react-hooks/exhaustive-deps
because that is an old comment and the dependencies have changed since.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✔️
export const useQueryParams = () => { | ||
return new URLSearchParams(useLocation().search); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want the result to be stable and only change when search has changed.
export const useQueryParams = () => { | |
return new URLSearchParams(useLocation().search); | |
}; | |
export const useQueryParams = () => { | |
const search = useLocation().search; | |
const queryParams = React.useMemo(() => new URLSearchParams(search), [search]); | |
return queryParams; | |
}; |
kindsInFlight, | ||
trafficData, | ||
}) => { | ||
const dataModelContext = React.useContext<ExtensibleModel>(ModelContext); | ||
const [model, setModel] = React.useState<Model>(null); | ||
const [loadError, setLoadError] = React.useState<string>(null); | ||
const params = useParams(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we are better off to pass in props than couple the component to URL params. Especially when the component is utility in nature.
match: RMatch<{ | ||
name?: string; | ||
}>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just accept namespace
here instead as to not couple this component to router or url.
d337eca
to
6d825e8
Compare
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: christianvogt, jeff-phillips-18 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Fixes
https://issues.redhat.com/browse/ODC-4346
https://issues.redhat.com/browse/ODC-4355
Description
Topology graph view needs to update node renderings when the selections change and when the filter value changes. Add a watcher on the match parameter to re-render when it changes.
/kind bug