Skip to content

fix(web): stop custom domain dialog bouncing to success and stacking close timers - #2947

Merged
richiemcilroy merged 1 commit into
CapSoftware:mainfrom
MinitJain:fix/custom-domain-dialog-step-bounce
Oct 23, 2026
Merged

richiemcilroy merged 1 commit into
CapSoftware:mainfrom
MinitJain:fix/custom-domain-dialog-step-bounce

Conversation

@MinitJain

@MinitJain MinitJain commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Problem

In the custom domain dialog (org settings), once a domain is verified:

  1. Clicking a completed step ("Domain" or "Verify") in the stepper jumps straight back to the success screen, so earlier steps can't be reviewed.
  2. The 8s auto-close timer piles up: every bounce or parent re-render schedules another handleClose, and those timers keep firing after the dialog unmounts.

Root cause

A single effect handled both auto-advance and auto-close, with deps [isVerified, stepState.currentIndex, handleClose, handleNext]:

  • With isVerified true, any step change that wasn't the success step called handleNext(). A stepper click (GO_TO_STEP) changed currentIndex, so the effect walked the user back to success.
  • The setTimeout had no cleanup. handleClose depends on onClose, which CustomDomain.tsx passes inline, so every parent re-render re-ran the effect and added another timer.

Fix

Split into two effects:

  • Auto-advance runs only when isVerified changes (GO_TO_STEP 2), so stepper navigation no longer re-triggers it.
  • Auto-close depends only on currentIndex, reads the latest handleClose through a ref, and clears its timer on cleanup. There's one timer per visit to the success step, and it doesn't restart on parent re-renders.

The new hooks sit above the if (!currentStep) return null early return, which also clears Biome's useHookAtTopLevel warning that the old effect had.

How to reproduce

  1. Org settings → Custom domain, with a verified domain. The dialog opens on the success step.
  2. Click "Domain" in the stepper. Before: it bounces back to success. After: it stays on Domain.
  3. Re-render the parent a few times while on success, or close the dialog. Before: several timers are live, and they still fire after unmount. After: exactly one timer, and none after unmount.

Tests

Two standalone repros, each rendering the real component with its boundary imports stubbed:

  • Stepper bounce: before {"afterClickDomain":"success","timersAfter":2}, after {"afterClickDomain":"domain","timersAfter":1}.
  • Timer leak: before {"afterRerenders":4,"afterUnmount":4}, after {"afterRerenders":1,"afterUnmount":0}.

Checks run locally:

  • lint (Biome): pass
  • typecheck: pass (no errors in this file)
  • build: not run (next build needs the app's environment and services)

RetriggerView in GreptileConfidence Score: 5/5

This PR appears safe to merge.

Summary

Separates verified-domain navigation from the dialog’s eight-second close timer.

  • The verified dialog lets people revisit completed steps.
  • The success step closes after one cancellable countdown.

Reviews (1) · Last reviewed commit: "fix(web): stop custom domain dialog boun..." · Reviewed by Greptile

…close timers

Clicking a completed step after verification re-ran the auto-advance effect and jumped back to success. The 8s auto-close had no cleanup and depended on the inline onClose, so every bounce or parent re-render scheduled another close that also survived unmount.
@vercel

vercel Bot commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
cap-status Skipped Skipped Oct 22, 2026 6:59pm UTC

@vercel
vercel Bot temporarily deployed to Preview – cap-status October 22, 2026 18:59 Inactive
@richiemcilroy
richiemcilroy merged commit 9919fe5 into CapSoftware:main Oct 23, 2026
30 of 31 checks passed

This branch was previously deployed

1 inactive deployment
Preview – cap-status — 78c0bf37 Deployed Oct 22, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants