Skip to content

fix(client): stop authentication modal oscillating when reopening Edit pool#96

Merged
rongxin-liu merged 1 commit intomainfrom
fix/edit-pool-auth-modal-oscillation
Apr 26, 2026
Merged

fix(client): stop authentication modal oscillating when reopening Edit pool#96
rongxin-liu merged 1 commit intomainfrom
fix/edit-pool-auth-modal-oscillation

Conversation

@rongxin-liu
Copy link
Copy Markdown
Contributor

@rongxin-liu rongxin-liu commented Apr 26, 2026

Summary

The fleet authentication modal oscillated up and down with a duplicated title when the user dismissed it and triggered Edit pool again. The same modal opened from Edit worker name was unaffected.

Root cause

Modal renders a zero-height sentinel and watches it with an IntersectionObserver to decide whether to collapse the body title into the sticky header on scroll. The mechanism has a layout feedback loop: when the observer flips isTitleCollapsed, the header height changes, the sentinel shifts, and the observer flips it back.

Edit pool surfaced this because its purpose cycles through null on dismiss, which changes Modal's title prop and re-fires the observer effect on each reopen. Edit worker name uses a hardcoded purpose="workerNames", so title never changes and the observer effect never re-runs after first mount.

Fix

Render the credential form's title and description as Modal children with showHeader={false}. With no title prop, Modal's observer effect early-returns and no sentinel is rendered, so the credential form opts out of the title-collapse machinery entirely — no observer, nothing to oscillate.

This is a one-file change scoped to AuthenticateFleetModal.

Follow-up opportunities

  • Consolidate auth modal instances. SingleMinerActionsMenu and MinerActionsMenu each render a separate <AuthenticateFleetModal purpose="workerNames"> alongside the shared pool/security instance. These can be consolidated into one shared instance by routing worker names through useFleetAuthentication / startAuthentication, removing duplicated state and JSX.
  • Fix Modal's observer. The latent IntersectionObserver layout feedback loop in Modal is left untouched here and can be addressed in a follow-up scoped to Modal itself.

Test plan

  • tsc --noEmit clean
  • ESLint clean on changed file
  • vitest MinerActionsMenu / useMinerActions / MinerList.modalFlow suites green
  • Manual: select miners → Edit pool → Cancel → Edit pool again, modal opens cleanly without oscillating or duplicate title
  • Manual: same flow for Manage security
  • Manual: Edit worker name still works

@rongxin-liu rongxin-liu requested a review from a team as a code owner April 26, 2026 01:25
Copilot AI review requested due to automatic review settings April 26, 2026 01:25
@github-actions github-actions Bot added javascript Pull requests that update javascript code client labels Apr 26, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 26, 2026

🔐 Codex Security Review

Note: This is an automated security-focused code review generated by Codex.
It should be used as a supplementary check alongside human review.
False positives are possible - use your judgment.

Scope summary

  • Reviewed pull request diff only (5bf1ee7544c7185bac6c38df8f366bc73b8a0ffe...4d15eef54176a5be5bebb82cd136603c5f3e90a1, exact PR three-dot diff)
  • Model: gpt-5.4

💡 Click "edited" above to see previous reviews for this PR.


Review Summary

Overall Risk: NONE

Findings

No material security, correctness, or reliability issues found in the reviewed diff. The change is limited to the AuthenticateFleetModal presentation: it disables the shared modal header and renders equivalent title/description markup inline, while leaving the verifyCredentials request, invalid-credential handling, dismissal flow, and onAuthenticated credential handoff unchanged.

Notes

  • Scope reviewed was only .git/codex-review.diff, which contains a single frontend-only change in client/src/protoFleet/features/auth/components/AuthenticateFleetModal/AuthenticateFleetModal.tsx.
  • I did not find changes affecting JWT/session handling, server-side authorization, gRPC/Connect-RPC boundaries, SQL/migrations, plugin trust boundaries, network discovery, infrastructure, protobufs, or mining pool/wallet configuration.
  • No cryptostealing or pool-hijack behavior appears in the reviewed hunks.
  • This was an inspection-only review. I did not run frontend tooling because client/node_modules is absent in the provided environment, and existing downstream tests mostly mock this modal, so direct automated coverage of this visual refactor appears limited.

Generated by Codex Security Review |
Triggered by: @rongxin-liu |
Review workflow run

Copy link
Copy Markdown

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

Fixes an oscillating Fleet authentication modal when reopening Edit pool by preventing the auth modal content from participating in the title-collapse observer behavior and by making the observer logic more robust across reopen cycles.

Changes:

  • Adjust Modal’s IntersectionObserver setup to avoid a 1px boundary feedback loop and to refresh the observer on close→open cycles.
  • Update AuthenticateFleetModal to render its title/description as children with showHeader={false}, bypassing the title-collapse/sentinel mechanism.

Reviewed changes

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

File Description
client/src/shared/components/Modal/Modal.tsx Adds a 1px rootMargin buffer and includes open in the observer effect deps to prevent oscillation on reopen.
client/src/protoFleet/features/auth/components/AuthenticateFleetModal/AuthenticateFleetModal.tsx Moves title/description into modal children and disables the modal header to avoid triggering collapse machinery.

Comment thread client/src/shared/components/Modal/Modal.tsx Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bc3acccf33

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

…t pool

The fleet authentication modal oscillated up and down with a duplicated
title when the user dismissed it and triggered Edit pool again. The same
modal opened from Edit worker name was unaffected.

Root cause: Modal's IntersectionObserver title-collapse machinery has a
layout feedback loop. When the observer flips isTitleCollapsed, the
header height changes, the sentinel shifts, and the observer flips it
back. Edit pool surfaced this because its purpose cycles through null on
dismiss, changing Modal's title prop and re-firing the observer effect on
each reopen. Edit worker name uses a hardcoded purpose so the title
never changes and the observer never re-runs.

Render the credential form's title and description as Modal children
with showHeader={false}. With no title prop, Modal's observer effect
early-returns and no sentinel is rendered, so the credential form opts
out of the title-collapse machinery entirely.

Made-with: Cursor
@rongxin-liu rongxin-liu force-pushed the fix/edit-pool-auth-modal-oscillation branch from bc3accc to 4d15eef Compare April 26, 2026 05:05
@rongxin-liu rongxin-liu merged commit 7465f46 into main Apr 26, 2026
141 of 145 checks passed
@rongxin-liu rongxin-liu deleted the fix/edit-pool-auth-modal-oscillation branch April 26, 2026 05:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

client javascript Pull requests that update javascript code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants