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 1996535: Improve detect namespace hook and fix redirect loop and e2e tests #9844
Bug 1996535: Improve detect namespace hook and fix redirect loop and e2e tests #9844
Conversation
6fb3135
to
6f396b1
Compare
9f5885b
to
43fbe96
Compare
/uncc abhinandan13jan vojtechszocs |
1aaf0d6
to
cd3ea84
Compare
@jerolimov: An error was encountered querying GitHub for users with public email (gamore@redhat.com) for bug 1996535 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. |
/bugzilla refresh |
@jerolimov: This pull request references Bugzilla bug 1996535, which is valid. 3 validation(s) were run on this bug
No GitHub users were found matching the public email listed for the QA contact in Bugzilla (gamore@redhat.com), skipping review request. 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. |
@jerolimov: This pull request references Bugzilla bug 1996535, which is valid. 3 validation(s) were run on this bug
No GitHub users were found matching the public email listed for the QA contact in Bugzilla (gamore@redhat.com), skipping review request. 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. |
@@ -64,28 +47,31 @@ export const useValuesForNamespaceContext = () => { | |||
} | |||
// Only run this hook after all resources have loaded. | |||
// eslint-disable-next-line react-hooks/exhaustive-deps | |||
}, [resourcesLoaded, useProjects]); | |||
}, [resourcesLoaded]); |
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.
won't we need useProjects
as well in the dependency list of 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.
As long as useProjects is pending the resourcesLoaded is false. It switches to true if everything is loaded (useProjects and 2 user settings). So the useEffect must not be called earlier.
The condition in the first line would ignore this extra call, but I think useProjects is not required 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.
got it 👍
const urlNamespace = getNamespace(pathname); | ||
const [lastNamespace, setLastNamespace, lastNamespaceLoaded] = useLastNamespace(); | ||
const urlNamespace = useUrlNamespace(); | ||
const [currentNamespace, setCurrentNamespace] = React.useState<string>(urlNamespace); |
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.
@jerolimov sorry getting confused here between what is activeNamespce
vs currentNamespace
, is it just a rename?
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.
That's right. Changed back to activeNamespace
. This makes also more sense with the useActiveNamespace
hook to consume this data. Changed the comments also that we set active namespace which means updating this internal state and the redux state.
cd3ea84
to
31fbda3
Compare
31fbda3
to
2816eb1
Compare
/lgtm verified the changes works as expected |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: invincibleJai, jerolimov 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 |
@jerolimov: All pull requests linked via external trackers have merged: Bugzilla bug 1996535 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://bugzilla.redhat.com/show_bug.cgi?id=1996535
https://issues.redhat.com/browse/ODC-6267
Analysis / Root cause:
This is an follow up for PR 9386 and this work is based on @nemesis09 work in PR 9846
Solution Description:
Cleanup the namespace hook. Ensure that it doesn't result in an rerendering or redirect loop.
setNamespace
(available as context value)Fix the crash in frontend/public/module/k8s/cluster-settings.ts with an additional
?.
check.Screen shots / Gifs for design review:
Recording of multiple namespace tests (4 mb)
namespace-tests.mp4
Unit test coverage report:
Tests changed and passes.
Test setup:
Test everything which is aligned to the following features and mix them:
Browser conformance: