Skip to content

Changed settings confirmations to a context provider - #29818

Merged
9larsons merged 1 commit into
mainfrom
slars/settings-confirmation-provider
Aug 10, 2026
Merged

9larsons merged 1 commit into
mainfrom
slars/settings-confirmation-provider

Conversation

@9larsons

@9larsons 9larsons commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

First slice of the settings NiceModal burn-down (follows the router swap #29780 and un-portal #29789).

ConfirmationModal and LimitModal were NiceModal-shown from 54 call sites across 27 files — the bulk of settings' remaining NiceModal usage. They now go through a settings-local ConfirmationProvider:

What changed

  • ConfirmationProvider (app/components/providers/confirmation-provider.tsx): useConfirmation() → confirm(props) / showLimit(props), each returning a {remove()} handle. The request types are the existing ConfirmationModalProps/LimitModalProps, testids stay confirmation-modal/limit-modal, and onOk still receives the close handle — so all 54 sites converted as a pure NiceModal.show(X, props) → confirm(props) substitution with prop objects verbatim.
  • One request per kind, matching NiceModal's per-component keying: a second show replaces the first instead of stacking — StrictMode double-effects (the verification-token flows) depend on this, caught by the suite during integration.
  • ConfirmationModalContent/LimitModalContent take visible/onRemove host props instead of useModal(); their NiceModal.create default exports are gone. The two direct renderers (theme-installed / invalid-theme dialogs) pass their own handles.
  • Prompt-closes-confirmation flows (the legacy useModal().remove()-from-inside-the-prompt trick): newsletter verification links and the theme upload picker now close via a handle closure passed from the confirm() caller — same UX, no NiceModal context needed. (This preserves behavior the earlier spike had documented as a lost capability.)
  • Provider wraps the NiceModal provider so the modals still shown imperatively (custom fields, welcome-email, theme/editor dialogs — the next burn-down slices) can confirm from inside their own flows.

Verification

  • Acceptance: 57 files / 433 tests pass (confirmation-heavy suites — custom fields, danger zone, staff, tiers, offers, newsletters verification — all green)
  • Unit: 128 files / 1374 pass, including the confirmation/limit tests rewritten onto the provider
  • tsc -b, full lint, boundaries clean

Remaining NiceModal in settings after this: 12 imperative dialog components (webhook, code, yaml, universal-import, feature-toggle, theme cluster, welcome-email pair, email-design, custom-field) — they convert to controlled Shade dialogs in follow-up slices, then the provider mount and the dependency go.

…provider

- ConfirmationModal and LimitModal were shown through NiceModal from 54 call sites; a settings-local ConfirmationProvider now hosts them behind confirm()/showLimit(), keeping the existing prop contracts, testids, and the onOk handle so call sites converted mechanically
- one request per kind matches NiceModal's per-component keying: a second show replaces the first instead of stacking, which StrictMode double-effects depend on
- prompt content that closed its surrounding confirmation through useModal (newsletter verification links, the theme upload picker) now closes through a handle closure passed from the confirm() caller
- the provider wraps the NiceModal provider so the modals still shown imperatively (custom fields, welcome email, theme and editor dialogs) can confirm from inside their own flows
@coderabbitai

coderabbitai Bot commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: cd9481ee-a892-4a23-a8bc-a7863ca2163f

📥 Commits

Reviewing files that changed from the base of the PR and between fadf960 and ce90cdd.

📒 Files selected for processing (36)
  • apps/admin/src/settings/app/app.tsx
  • apps/admin/src/settings/app/components/confirmation-modal.test.tsx
  • apps/admin/src/settings/app/components/confirmation-modal.tsx
  • apps/admin/src/settings/app/components/limit-modal.test.tsx
  • apps/admin/src/settings/app/components/limit-modal.tsx
  • apps/admin/src/settings/app/components/providers/confirmation-provider.tsx
  • apps/admin/src/settings/app/components/settings/advanced/danger-zone.tsx
  • apps/admin/src/settings/app/components/settings/advanced/integrations.tsx
  • apps/admin/src/settings/app/components/settings/advanced/integrations/add-integration-modal.tsx
  • apps/admin/src/settings/app/components/settings/advanced/integrations/custom-integration-modal.tsx
  • apps/admin/src/settings/app/components/settings/advanced/integrations/transistor-modal.tsx
  • apps/admin/src/settings/app/components/settings/advanced/integrations/webhooks-table.test.tsx
  • apps/admin/src/settings/app/components/settings/advanced/integrations/webhooks-table.tsx
  • apps/admin/src/settings/app/components/settings/advanced/integrations/zapier-modal.tsx
  • apps/admin/src/settings/app/components/settings/advanced/migration-tools/universal-import-modal.tsx
  • apps/admin/src/settings/app/components/settings/email/emails.tsx
  • apps/admin/src/settings/app/components/settings/email/newsletters.tsx
  • apps/admin/src/settings/app/components/settings/email/newsletters/add-newsletter-modal.tsx
  • apps/admin/src/settings/app/components/settings/email/newsletters/newsletter-detail-modal.tsx
  • apps/admin/src/settings/app/components/settings/email/newsletters/newsletters-tab-content.tsx
  • apps/admin/src/settings/app/components/settings/general/user-detail-modal.tsx
  • apps/admin/src/settings/app/components/settings/general/users/staff-token.tsx
  • apps/admin/src/settings/app/components/settings/growth/offers/edit-offer-modal.tsx
  • apps/admin/src/settings/app/components/settings/growth/recommendations/edit-recommendation-modal.tsx
  • apps/admin/src/settings/app/components/settings/membership/custom-fields/custom-field-modal.tsx
  • apps/admin/src/settings/app/components/settings/membership/member-emails.tsx
  • apps/admin/src/settings/app/components/settings/membership/portal/portal-modal.tsx
  • apps/admin/src/settings/app/components/settings/membership/stripe/stripe-connect-modal.tsx
  • apps/admin/src/settings/app/components/settings/membership/tiers.tsx
  • apps/admin/src/settings/app/components/settings/membership/tiers/tier-detail-modal.tsx
  • apps/admin/src/settings/app/components/settings/site/change-theme.tsx
  • apps/admin/src/settings/app/components/settings/site/design-and-theme-modal.tsx
  • apps/admin/src/settings/app/components/settings/site/theme-modal.tsx
  • apps/admin/src/settings/app/components/settings/site/theme/advanced-theme-settings.tsx
  • apps/admin/src/settings/app/components/settings/site/theme/invalid-theme-modal.tsx
  • apps/admin/src/settings/app/components/settings/site/theme/theme-installed-modal.tsx

Walkthrough

The settings app now provides ConfirmationProvider with confirm and showLimit operations. Confirmation and limit dialogs receive visibility and removal callbacks from the provider. Settings consumers across advanced, email, general, growth, membership, site, and theme areas now use the provider instead of direct NiceModal calls. Related tests now render components within ConfirmationProvider. Two theme dialogs retain NiceModal lifecycle control through the updated host props.

Possibly related PRs

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed The description clearly explains the migration from NiceModal to ConfirmationProvider and covers the main implementation and verification details.
Title check ✅ Passed The title clearly summarizes the main change: moving settings confirmations to a context provider.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch slars/settings-confirmation-provider

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nx-cloud

nx-cloud Bot commented Aug 6, 2026 •

Copy link
Copy Markdown

🤖 Nx Cloud AI Fix

Ensure the fix-ci command is configured to always run in your CI pipeline to get automatic fixes in future runs. For more information, please see https://nx.dev/ci/features/self-healing-ci


View your CI Pipeline Execution ↗ for commit ce90cdd

Command Status Duration Result
nx run @tryghost/admin:test:acceptance ✅ Succeeded 6m 6s View ↗
nx run @tryghost/admin:build ✅ Succeeded 9s View ↗
nx run-many -t test:unit -p @tryghost/admin ✅ Succeeded 2m 39s View ↗
nx run ghost-monorepo:lint:boundaries ✅ Succeeded 22s View ↗
nx run-many -t lint -p @tryghost/admin,ghost-mo... ✅ Succeeded 1m 19s View ↗
nx run-many --target=build --projects=tag:publi... ✅ Succeeded <1s View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-08-06 23:21:37 UTC

@9larsons
9larsons merged commit bd61548 into main Aug 10, 2026
49 checks passed
@9larsons
9larsons deleted the slars/settings-confirmation-provider branch August 10, 2026 22:22
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.

1 participant