Skip to content

feat(staged): prefill the new-project repo from a single repo filter - #935

Merged
matt2e merged 2 commits into
mainfrom
prefill-project-when-filtered
Aug 31, 2026
Merged

feat(staged): prefill the new-project repo from a single repo filter#935
matt2e merged 2 commits into
mainfrom
prefill-project-when-filtered

Conversation

@matt2e

@matt2e matt2e commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

When the New Project dialog opens without an explicit repo and the window it opens in has exactly one repo filter chip active, seed the form's repo field with that chip's repo + subpath. Zero or several active repo chips still open the dialog empty; status chips (Unread, Running) don't affect the check, so one repo chip prefills even alongside them.

Changes

  • repoSeedFromNewProjectEvent falls back to a new pure repoSeedFromRepoFilters helper when the event carries no repo detail. That covers ⌘N and the sidebar + across all three listening views with no call-site changes; a repo card still dispatches its own repo and keeps precedence.
  • The landing top-bar + button now dispatches the plain staged:new-project event instead of opening the modal directly, so every plain trigger goes through the one listener path and no opener has to remember the seeding rule itself.
  • Unit tests for both helpers: single filter (with and without subpath), zero filters, multiple filters, event-detail precedence, and the neither-source case.

The filter store is module-scoped, hence per-webview, so each window prefills from its own filters. The prefill is a seed, not a lock — the field stays editable.

matt2e and others added 2 commits August 27, 2026 15:10
When the New Project dialog opens without an explicit repo and the window
it opens in has exactly one repo filter chip active, seed the form's repo
field with that chip's repo + subpath. Zero or several active repo chips
still open the dialog empty; status chips (Unread, Running) don't affect
the check, so one repo chip prefills even alongside them.

`repoSeedFromNewProjectEvent` falls back to the new pure
`repoSeedFromRepoFilters` helper when the event carries no repo detail,
which covers ⌘N and the sidebar + across all three listening views with
no call-site changes; a repo card still dispatches its own repo and keeps
precedence. The landing top-bar + button opens the modal directly rather
than via the event, so it calls the helper itself.

The filter store is module-scoped, hence per-webview, so each window
prefills from its own filters. The prefill is a seed, not a lock — the
field stays editable.

Signed-off-by: Matt Toohey <contact@matttoohey.com>
…ared event

Review 36733ca2 flagged that the landing top-bar + button was the only
opener that had to remember the repo-filter seeding rule itself, calling
repoSeedFromRepoFilters directly while ⌘N and the sidebar + dispatched
the plain staged:new-project event and inherited the seed from the
listener.

Dispatch the no-detail event from the button instead, collapsing every
plain trigger onto the one listener path in this component (guaranteed
mounted whenever the button is clickable) and dropping the now-unused
import and explanatory comment. No behavior change: the listener applies
the same repoSeedFromNewProjectEvent fallback.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Matt Toohey <contact@matttoohey.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 970f596164

ℹ️ 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".

export function repoSeedFromNewProjectEvent(event: Event): RepoSelection | null {
const detail = (event as CustomEvent<NewProjectEventDetail | undefined>).detail;
if (!detail?.githubRepo) return null;
if (!detail?.githubRepo) return repoSeedFromRepoFilters(projectFiltersStore.activeRepoFilters);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Pass the fallback seed into the splash form

When the last project is deleted while a repo filter remains active, the filter store deliberately retains that stale selection, but both ProjectsList.svelte and ProjectHome.svelte render SplashScreen instead of the modal. SplashScreen has no initialRepo prop and creates NewProjectForm with empty repo bindings, while NewProjectModal is gated off in this state, so the fallback computed here is discarded and Cmd-N/the top-bar button opens an unprefilled form. Thread the seed through the empty-state form as well.

Useful? React with 👍 / 👎.

@matt2e
matt2e merged commit 4b235c6 into main Aug 31, 2026
4 checks passed
@matt2e
matt2e deleted the prefill-project-when-filtered branch August 31, 2026 02:03
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