fix(client): stop authentication modal oscillating when reopening Edit pool#96
Conversation
🔐 Codex Security Review
Review SummaryOverall Risk: NONE FindingsNo material security, correctness, or reliability issues found in the reviewed diff. The change is limited to the Notes
Generated by Codex Security Review | |
There was a problem hiding this comment.
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’sIntersectionObserversetup to avoid a 1px boundary feedback loop and to refresh the observer on close→open cycles. - Update
AuthenticateFleetModalto render its title/description as children withshowHeader={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. |
There was a problem hiding this comment.
💡 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
bc3accc to
4d15eef
Compare
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
Modalrenders a zero-height sentinel and watches it with anIntersectionObserverto decide whether to collapse the body title into the sticky header on scroll. The mechanism has a layout feedback loop: when the observer flipsisTitleCollapsed, the header height changes, the sentinel shifts, and the observer flips it back.Edit pool surfaced this because its
purposecycles throughnullon dismiss, which changesModal'stitleprop and re-fires the observer effect on each reopen. Edit worker name uses a hardcodedpurpose="workerNames", sotitlenever changes and the observer effect never re-runs after first mount.Fix
Render the credential form's title and description as
Modalchildren withshowHeader={false}. With notitleprop,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
SingleMinerActionsMenuandMinerActionsMenueach render a separate<AuthenticateFleetModal purpose="workerNames">alongside the shared pool/security instance. These can be consolidated into one shared instance by routing worker names throughuseFleetAuthentication/startAuthentication, removing duplicated state and JSX.Modal's observer. The latentIntersectionObserverlayout feedback loop inModalis left untouched here and can be addressed in a follow-up scoped toModalitself.Test plan
tsc --noEmitcleanvitestMinerActionsMenu/useMinerActions/MinerList.modalFlowsuites green