Skip to content

frontend: NamespacesAutocomplete: Fix react-hooks/exhaustive-deps — add missing deps to useDefaultNamespaceFallback#5696

Open
rajeshsingh241 wants to merge 1 commit into
kubernetes-sigs:mainfrom
rajeshsingh241:fix/namespacesautocomplete-exhaustive-deps
Open

frontend: NamespacesAutocomplete: Fix react-hooks/exhaustive-deps — add missing deps to useDefaultNamespaceFallback#5696
rajeshsingh241 wants to merge 1 commit into
kubernetes-sigs:mainfrom
rajeshsingh241:fix/namespacesautocomplete-exhaustive-deps

Conversation

@rajeshsingh241
Copy link
Copy Markdown
Contributor

@rajeshsingh241 rajeshsingh241 commented May 16, 2026

Add allClustersConfigs as a genuine missing dependency to the
useEffect in useDefaultNamespaceFallback hook.

selectedNamespaces and dispatch are intentionally kept out of
the dependency array — adding selectedNamespaces causes infinite
re-renders when the user clears the namespace filter, and dispatch
is stable across renders (Redux guarantee). The eslint suppression
is kept with an inline comment explaining this.

Part of #5183

@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: rajeshsingh241
Once this PR has been reviewed and has the lgtm label, please assign illume for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details 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

@k8s-ci-robot k8s-ci-robot requested review from illume and yolossn May 16, 2026 13:39
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels May 16, 2026
@illume illume requested a review from Copilot May 16, 2026 14:51
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates NamespacesAutocomplete to satisfy react-hooks/exhaustive-deps for the default namespace fallback effect.

Changes:

  • Adds missing dependencies to useDefaultNamespaceFallback’s useEffect.
  • Removes the prior exhaustive-deps suppression comment.

Review context: CI/check status and PR commit history were not available; please confirm CI results and linear history.

Comment thread frontend/src/components/common/NamespacesAutocomplete.tsx Outdated
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels May 16, 2026
@illume illume requested a review from Copilot May 17, 2026 06:41
Copy link
Copy Markdown
Contributor

@illume illume left a comment

Choose a reason for hiding this comment

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

Thanks for this PR.

A few of the commits don't quite follow the project guidelines. We use Linux kernel style for git commits — have a look at the contributing guide and previous commits with git log.

Commits that need attention
  • frontend: NamespacesAutocomplete: fix prettier formatting — Description must start with a capital letter — e.g. frontend: HomeButton: Fix the button not frontend: HomeButton: fix the button.
Commit guidelines
  • Use atomic commits focused on a single change.
  • Use the title format <area>: <Description of changes> — description must start with a capital letter.
  • Keep the title under 72 characters (soft requirement).
  • Explain the intention and why the change is needed.
  • Make commit titles meaningful and describe what changed.
  • Do not add code that a later commit rewrites; squash or reorder commits instead.
  • Do not include Fixes #NN in commit messages.

Good examples:

  • frontend: HomeButton: Fix so it navigates to home
  • backend: config: Add enable-dynamic-clusters flag

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread frontend/src/components/common/NamespacesAutocomplete.tsx Outdated
@rajeshsingh241 rajeshsingh241 force-pushed the fix/namespacesautocomplete-exhaustive-deps branch from 630a6db to e69d98a Compare May 17, 2026 08:02
@k8s-ci-robot k8s-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels May 17, 2026
@rajeshsingh241
Copy link
Copy Markdown
Contributor Author

Thanks for the review @illume! I've squashed the commits into one and fixed the dependency array-- selectedNamespaces and dispatch are now intentionally omitted with comments explaining why. Please take another look.

@rajeshsingh241 rajeshsingh241 force-pushed the fix/namespacesautocomplete-exhaustive-deps branch 2 times, most recently from 1704c78 to f81478b Compare May 17, 2026 08:18
Remove eslint suppression in useDefaultNamespaceFallback. Add
allClustersConfigs to deps; omit selectedNamespaces (would cause
infinite re-renders when user clears filter) and dispatch (stable
across renders per Redux guarantee).

Part of kubernetes-sigs#5183

Signed-off-by: desibrownsugar <brownsugar34125@gmail.com>
@rajeshsingh241 rajeshsingh241 force-pushed the fix/namespacesautocomplete-exhaustive-deps branch from f81478b to ae25c13 Compare May 17, 2026 08:31
Copy link
Copy Markdown
Contributor

@illume illume left a comment

Choose a reason for hiding this comment

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

Thanks for these changes.

Can you please address the open review comments? Once you've resolved each one, please mark it as resolved.

@rajeshsingh241
Copy link
Copy Markdown
Contributor Author

@illume I've resolved both Copilot review comments. Please take another look when you get a chance.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread frontend/src/components/common/NamespacesAutocomplete.tsx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants