Skip to content

Conversation

@bcotrim
Copy link
Contributor

@bcotrim bcotrim commented Dec 24, 2025

Related issues

Proposed Changes

  • Add quit confirmation dialog when user quits Studio with running sites
  • Dialog offers two options: "Stop sites" or "Leave running"
  • "Remember my choice" checkbox saves preference to skip dialog on future quits
  • Store preference as stopSitesOnQuit boolean in user data (undefined = show dialog, true = stop, false = leave running)
  • Add getRunningSiteCount() helper function to track running sites
  • Conditionally stop servers on quit based on user preference

Testing Instructions

Happy Path

  • Start one or more sites, then quit Studio (Cmd+Q or close window)
  • Verify modal appears with "Stop sites" and "Leave running" buttons
  • Click "Stop sites" → verify sites stop, then app quits
  • Click "Leave running" → verify app quits but sites continue running (check with studio site list)

Remember Choice

  • Start a site, quit Studio, check "Remember my choice", click "Stop sites"
  • Start a site again, quit Studio → verify no dialog appears and sites stop
  • To reset: manually delete stopSitesOnQuit from ~/Library/Application Support/WordPress Studio/appdata-v1.json

Edge Cases

  • Quit with no running sites → no dialog should appear
  • CMD+Q keyboard shortcut respects modal behavior

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

@bcotrim bcotrim self-assigned this Dec 24, 2025
@bcotrim bcotrim requested review from a team and fredrikekelund December 24, 2025 15:37
runningSiteCount
),
buttons: [ __( 'Stop sites' ), __( 'Leave running' ) ],
checkboxLabel: __( 'Remember my choice' ),
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we use something lile "Don't ask again" to be consistent with other checkboxes around the app?

Copy link
Contributor

Choose a reason for hiding this comment

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

I see that actually we have default fallback as Don't show this warning again. I would propose change teh default value to Don't ask again and remove checkboxLabel here and in src/components/content-tab-import-export.tsx

checkboxLabel: __( 'Remember my choice' ),
cancelId: LEAVE_RUNNING_BUTTON_INDEX,
defaultId: STOP_SITES_BUTTON_INDEX,
} );
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it looks fine but I am wondering about the scenario where the user might change their mind and for example, might want to stop some sites manually. Should not they have an option to close this disalog without picking anything?

Image

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, if we go with adding this option, let's ensure that the Esc button just closes the popup, since now it applies "closing app w/o turning off sites", which is IMO a bit unexpected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants