Skip to content

fix(desktop): keep Create controls on empty Projects + fix stale deletion tombstone (#4009) - #4118

Open
iroiro147 wants to merge 1 commit into
block:mainfrom
iroiro147:claude/issue4009-projects-empty-create-20260802
Open

fix(desktop): keep Create controls on empty Projects + fix stale deletion tombstone (#4009)#4118
iroiro147 wants to merge 1 commit into
block:mainfrom
iroiro147:claude/issue4009-projects-empty-create-20260802

Conversation

@iroiro147

Copy link
Copy Markdown

Summary

Changes

  • ProjectCards.tsxEmptyState gains optional onCreateRepository prop and CTA button (projects-empty-create-repository)
  • ProjectsView.tsx — removes the early return that prevented the Create menu from mounting on empty lists; renders `EmptyState with the create callback inside the content area
  • hooks.tsisDeletedByA adds timestamp comparison (event.created_at > project.createdAt) and is exported for testability
  • hooks.test.mjs (new) — 6 node:test unit tests covering: deletion-newer-hides, deletion-older-doesn't-hide (re-announcement), same-timestamp edge, non-owner doesn't hide, different coordinate doesn't hide, mixed stale+fresh events
  • projects-empty-create.spec.ts (new) — Playwright e2e covering both Create entry points (projects-create-menu and projects-empty-create-repository) on the empty Projects view
  • playwright.config.ts — registers the e2e spec in smoke tests

Verification

  • pnpm typecheck — clean
  • pnpm exec biome check — clean
  • pnpm test — 3912 passed, 0 failed

Supersedes closed PR #3620
Fixes #4009

…tion tombstone (block#4009)

Two-part fix for the Projects view:

**Part 1: Empty Projects hides Create controls**
The early return `if (projects.length === 0) return <EmptyState />` prevented
the entire Projects chrome (header, filters, create menu) from mounting when
there were zero visible projects. Users couldn't create the first project
from the empty view.

Changes:
- `ProjectCards.tsx`: Add optional `onCreateRepository` prop to `EmptyState`;
  renders a "Create repository" CTA button with `data-testid="projects-empty-create-repository"`.
- `ProjectsView.tsx`: Remove the early return so the full Projects layout
  (with `ProjectsCreateMenu`) always mounts; render `EmptyState` with the
  create callback inside the content area when `projects.length === 0`.
- `playwright.config.ts`: Register `projects-empty-create.spec.ts` in smoke tests.
- `tests/e2e/projects-empty-create.spec.ts`: E2E covering both entry points —
  the `+` Create menu and the empty-state `Create repository` button both open
  the create-project dialog.

**Part 2: Deleted and re-announced projects remain missing**
`isDeletedByA` filtered projects whenever ANY deletion event existed from the
owner referencing the project coordinate, regardless of timestamps. After
deleting and re-publishing a project, the stale deletion event permanently
tombstoned the re-announced project.

Fix: `isDeletedByA` now only hides projects when the deletion event's
`created_at` is strictly newer than the (re-)announcement's `created_at`.
Deleting then re-publishing a project correctly shows it again.

Changes:
- `hooks.ts`: Add timestamp comparison `event.created_at > project.createdAt`
  to the deletion check; export `isDeletedByA` for testability.
- `hooks.test.mjs`: 6 unit tests covering: deletion-newer-hides,
  deletion-older-doesnt-hide, same-timestamp-doesnt-hide, non-owner-doesnt-hide,
  different-coordinate-doesnt-hide, mixed-stale+fresh-events.

Verification:
- `pnpm typecheck` — clean
- `pnpm exec biome check` — clean (after auto-fix)
- `pnpm test` — 3912 passed, 0 failed (including 6 new isDeletedByA tests)

Fixes block#4009
Supersedes closed PR block#3620 (conflicts with current main).
Signed-off-by: Sarthak Singh <sarthak.singh@juspay.in>
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.

Projects view hides Create controls when no projects are visible

1 participant