Skip to content

frontend: OauthPopup: Fix stale closures on auth completion#6481

Open
anushkagupta200615-jpg wants to merge 2 commits into
kubernetes-sigs:mainfrom
anushkagupta200615-jpg:fix-oauth-stale-closures
Open

frontend: OauthPopup: Fix stale closures on auth completion#6481
anushkagupta200615-jpg wants to merge 2 commits into
kubernetes-sigs:mainfrom
anushkagupta200615-jpg:fix-oauth-stale-closures

Conversation

@anushkagupta200615-jpg

Copy link
Copy Markdown

Summary

This PR fixes a bug where the login popup was using outdated information if the main page refreshed while the popup was still open.

Related Issue

Fixes #6480

Changes

  • Fixed a bug in OauthPopup.tsx where the popup would get "stuck" using the original functions it was given when it first opened.
  • Added a latestProps tracker so the popup always knows about the newest updates from the main page and uses the most up-to-date versions of the onCode and onClose functions.

Steps to Test

  1. Click the login button to open the OAuth popup window.
  2. Complete the login process inside the popup.
  3. Make sure the popup closes automatically and the main Headlamp app logs you in successfully without getting stuck.

Screenshots (if applicable)

N/A - This is a behind-the-scenes logic fix, so nothing looks different on the screen.

Notes for the Reviewer

I removed onCode from the shortcut list at the top of the function to prevent a linter error, since we are now explicitly calling latestProps.current.onCode instead!

@kubernetes-prow kubernetes-prow Bot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jul 11, 2026
@kubernetes-prow kubernetes-prow Bot requested review from illume and yolossn July 11, 2026 22:59
@kubernetes-prow kubernetes-prow Bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jul 11, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: anushkagupta200615-jpg, Nachiket-Roy
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

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/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Stale closures in OauthPopup ignore updated props on auth completion

2 participants