Skip to content
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

Merged
merged 1 commit into from Sep 3, 2021

Conversation

sahil143
Copy link
Contributor

fixes: https://issues.redhat.com/browse/ODC-6263

This PR fixes react warnings on the topology page with setQueryArguments and setState call.

@openshift-ci openshift-ci bot added the component/topology Related to topology label Aug 24, 2021
@sahil143 sahil143 changed the title fix react warnings while loading topology page Bug 1997108: fix react warnings while loading topology page Aug 24, 2021
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Aug 24, 2021

@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 /bugzilla refresh.

In response to this:

Bug 1997108: fix react warnings while loading topology page

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.

@sahil143 sahil143 force-pushed the odc-6263 branch 2 times, most recently from e4d2395 to 916e991 Compare August 30, 2021 06:11
Comment on lines 192 to 200
if (!visualizationRef.current) {
visualizationRef.current = createVisualization();
}
const visualization = visualizationRef.current;

React.useEffect(() => {
if (!visualizationRef.current) {
visualizationRef.current = createVisualization();
}
}, [createVisualization]);

Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@invincibleJai
Copy link
Member

/retest-required

@invincibleJai
Copy link
Member

/approve

cc @christianvogt

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 31, 2021
@sahil143 sahil143 force-pushed the odc-6263 branch 3 times, most recently from 65baa4f to 21f2294 Compare September 2, 2021 10:52
@openshift-ci openshift-ci bot added component/dev-console Related to dev-console component/helm Related to helm-plugin labels Sep 2, 2021
Comment on lines 98 to 101
'/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',
Copy link
Contributor

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.

Copy link
Contributor Author

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

Copy link
Contributor

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?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that's correct.

@christianvogt
Copy link
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Sep 2, 2021
@openshift-bot
Copy link
Contributor

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@sahil143
Copy link
Contributor Author

sahil143 commented Sep 2, 2021

@makambalaji The tests are failing on this PR as well for helm.

@sahil143
Copy link
Contributor Author

sahil143 commented Sep 2, 2021

/bugzilla refresh

@openshift-ci openshift-ci bot added the bugzilla/severity-low Referenced Bugzilla bug's severity is low for the branch this PR is targeting. label Sep 2, 2021
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Sep 2, 2021

@sahil143: This pull request references Bugzilla bug 1997108, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.9.0) matches configured target release for branch (4.9.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

In response to this:

/bugzilla refresh

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.

@openshift-ci openshift-ci bot added the bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. label Sep 2, 2021
@sahil143
Copy link
Contributor Author

sahil143 commented Sep 3, 2021

/retest

@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Sep 3, 2021
Copy link
Contributor

@rohitkrai03 rohitkrai03 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Sep 3, 2021
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Sep 3, 2021

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-robot openshift-merge-robot merged commit f4a7cb4 into openshift:master Sep 3, 2021
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Sep 3, 2021

@sahil143: All pull requests linked via external trackers have merged:

Bugzilla bug 1997108 has been moved to the MODIFIED state.

In response to this:

Bug 1997108: fix react warnings while loading topology page

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.

@spadgett spadgett added this to the v4.9 milestone Sep 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. bugzilla/severity-low Referenced Bugzilla bug's severity is low for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. component/dev-console Related to dev-console component/helm Related to helm-plugin component/topology Related to topology lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants