Skip to content

Open the Create site dialog when the app launches with no sites - #798

Open
ryanwelcher wants to merge 3 commits into
trunkfrom
update/730-open-create-dialog-on-empty-launch
Open

ryanwelcher wants to merge 3 commits into
trunkfrom
update/730-open-create-dialog-on-empty-launch

Conversation

@ryanwelcher

Copy link
Copy Markdown
Collaborator

Why

At WCEH Contributor Day, first-time contributors opened the app, saw "No sites" and a Create site button, and did not know what the button would do. They stopped there. See #730.

What changes

When the app launches and its site list loads with no sites in it, the Create site dialog opens by itself, focused on the name field.

  • It waits for both the site list and the settings to be read. The list is empty for everyone until its first read answers, and the dialog takes its "New sites go here" folder from the settings when it opens.
  • It opens once per window. Closing it leaves the empty state as it was, and deleting the last site later does not reopen it.
  • The decision is in src/renderer/launch-create-offer.cjs, with unit tests. index.jsx keeps the flag and the call.

Deliberately not in it: renaming "site" (to "Contribution Environment", as the issue suggests), any new or changed string, and a stored "first launch" flag.

How to test this

The journeys cover the reported path:

  • npm run test:e2e:hidden -- tests/e2e/journeys/shell.spec.js, from the repository root. "a window with no site in it opens the create dialog…" and "the dialog an empty launch opens starts in the folder…" both fail without the change.
  • node --test tests/unit/launch-create-offer.test.cjs covers the wait for settings and the once-only rule.

What the journeys cannot reach is a packaged build on a fresh profile. Platforms: any. Use the Buildkite artifact for the current head.

Starting state: the app has never been run on this machine, or every site has been deleted from it.

  1. Open the app. The Create site dialog is open, with the cursor in Site name.
  2. Press Escape. The window shows "No sites" and a Create site button. The dialog does not come back.
  3. Click Create site, fill in the dialog and create a site. Setup runs as before.
  4. Quit and reopen the app. The site opens and the dialog does not.

What must not have happened:

  • The dialog flashing open for a moment on a launch that has sites.
  • The dialog reopening after you delete your last site in the same session.
  • With New sites go here set in Settings, the dialog that opens itself showing "No folder selected yet." instead of that folder.

Risks and limitations

  • Journeys that launch with no sites now meet an open dialog. The four i18n journeys that do this close it first. The engine journeys that launch empty do not use the window.
  • tests/e2e/real-setup/create-site.spec.js was updated to wait for the dialog instead of clicking the button. It runs only through the manual real-setup.yml workflow and was not run.
  • "the Logs are fully translatable" (i18n.spec.js:1047) fails locally, and fails the same way with trunk's renderer. It is not caused by this branch.

Related

Fixes #730


Design decisions and alternatives considered
  • Open whenever a launch finds no sites, not only on the first launch ever. A stored first-run flag would add persisted state and would miss someone who comes back with no sites.
  • Rename "site" to "Contribution Environment". Left for later. "Site" is in about 135 strings, the docs and the journeys. It also means two things in the app: the environment you create, and the WordPress you load in a browser. Renaming would leave all 16 translation catalogs falling back to English until they are retranslated.
Review outcome (required — see AGENTS.md)

4 [fix here] · 1 [follow-up]. All 4 fixed, 1 deferred.

  • Review: completed. Reviewer: a separate agent context (Explore subagent), following .github/instructions/code-review.instructions.md. Reviewed head edd8caa2364c798f1835b2f60e844dcb19fc620f, base 8ac1794b43cd5a52d5bbb5022d1e4bf4419b6964. npm run lint was clean and npm test passed before the judgement pass.
    • Fixed: the launch decision was inline in index.jsx and unit-untestable. It is now launch-create-offer.cjs, with tests.
    • Fixed: the empty-state and create-site-modal screenshot shots, and docs/guide/creating-a-site.md, assumed the dialog had to be clicked open. The shots were re-captured: empty-state came out byte-identical, and create-site-modal now shows the name field's placeholder, which the committed image predated.
    • Fixed: the folder journey's comment claimed to cover the wait for settings, which a journey cannot reach. It was reworded, and the unit tests cover that wait.
    • Fixed: the delete-site check for "no dialog" could pass before a reopen would render. It now waits for one round trip first, and removing the once-only guard turns it red.
    • Deferred [follow-up]: the deep-link notice with no site says "Create one from the sidebar", and a window with no site has no sidebar. This predates the branch and needs a string change.
  • Since review: edd8caa → 576a8afe16bb4b7932fc2afc6b8a00137c0dd894. That commit holds the four fixes above. Each was checked by its own test, and npm run lint, npm test (2323 pass, 0 fail) and the shell, delete-site, create-site and legacy-site journeys (11/11) passed on it. It was not re-reviewed by a fresh context.
Implementation notes
  • useSites gains loaded, its own useState, because applySetup callers replace the { sites, siteMeta } pair whole.
  • Settings are normally read before the first render (index.jsx, Promise.all([loadLocale(), loadSettings()])), so in practice the wait for settings matters only when that first read fails.
Screenshots or recording

What a launch with no sites now shows (docs/public/screenshots/create-site-modal.png on this branch):

The Create site dialog open over the empty window, with the cursor in Site name

Before, the same launch showed docs/public/screenshots/empty-state.png ("No sites" and a Create site button). That is now what the window shows after the dialog is closed.

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Nov 27, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

This branch has not been deployed

No deployments
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.

Opening the app for the first time shows an empty shell, and it isn't clear what "Create a site" does

1 participant