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
Bug 1997108: fix react warnings while loading topology page #9866
Conversation
@sahil143: An error was encountered querying GitHub for users with public email (gamore@redhat.com) for bug 1997108 on the Bugzilla server at https://bugzilla.redhat.com. No known errors were detected, please see the full error message for details. Full error message.
non-200 OK status code: 403 Forbidden body: "{\n \"documentation_url\": \"https://docs.github.com/en/free-pro-team@latest/rest/overview/resources-in-the-rest-api#secondary-rate-limits\",\n \"message\": \"You have exceeded a secondary rate limit. Please wait a few minutes before you try again.\"\n}\n"
Please contact an administrator to resolve this issue, then request a bug refresh with In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
e4d2395
to
916e991
Compare
if (!visualizationRef.current) { | ||
visualizationRef.current = createVisualization(); | ||
} | ||
const visualization = visualizationRef.current; | ||
|
||
React.useEffect(() => { | ||
if (!visualizationRef.current) { | ||
visualizationRef.current = createVisualization(); | ||
} | ||
}, [createVisualization]); | ||
|
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.
Updating a ref
in the render flow is ok. This doesn't require a change for it to be done inside an effect.
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.
there is a setState call inside createVisualization
, that's why moved the ref inside an effect.
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 didn't realize that createVisualization
was executing a callback which could set state. In that case what about:
if (!visualizationRef.current) {
visualizationRef.current = createVisualization();
}
const visualization = visualizationRef.current;
React.useEffect(() => {
if (visualization) {
setVisualization(visualization);
}
}, [visualization]);
Then remove setVisualization
from createVisualization
.
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.
Make sure to also fix-up TopologyListView
which does something similar.
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.
@christianvogt fixed
/retest-required |
/approve |
65baa4f
to
21f2294
Compare
'/topology/all-namespaces/graph', | ||
'/topology/ns/:name/graph', | ||
'/topology/all-namespaces/list', | ||
'/topology/ns/:name/list', | ||
'/topology/all-namespaces?view=graph', | ||
'/topology/ns/:name?view=graph', | ||
'/topology/all-namespaces?view=list', | ||
'/topology/ns/:name?view=list', |
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 you can remove these paths altogether since the query params don't matter here.
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.
removed, only kept ones that are without the query params
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 I presume this change is OCP 4.9+ only?
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.
Yes that's correct.
/lgtm |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
@makambalaji The tests are failing on this PR as well for helm. |
/bugzilla refresh |
@sahil143: This pull request references Bugzilla bug 1997108, which is valid. 3 validation(s) were run on this bug
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/retest |
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.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: christianvogt, invincibleJai, rohitkrai03, sahil143 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 |
@sahil143: All pull requests linked via external trackers have merged: Bugzilla bug 1997108 has been moved to the MODIFIED state. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
fixes: https://issues.redhat.com/browse/ODC-6263
This PR fixes react warnings on the topology page with setQueryArguments and setState call.