fix(desktop): keep Create controls on empty Projects + fix stale deletion tombstone (#4009) - #4118
Open
iroiro147 wants to merge 1 commit into
Open
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Create repositoryCTA to the empty state — both entry points open the create dialogisDeletedByAnow only tombstones a project when the deletion event'screated_atis strictly newer than the re-announcement'screated_at, so deleting and re-publishing a project correctly shows it againChanges
ProjectCards.tsx—EmptyStategains optionalonCreateRepositoryprop 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 areahooks.ts—isDeletedByAadds timestamp comparison (event.created_at > project.createdAt) and is exported for testabilityhooks.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 eventsprojects-empty-create.spec.ts(new) — Playwright e2e covering both Create entry points (projects-create-menuandprojects-empty-create-repository) on the empty Projects viewplaywright.config.ts— registers the e2e spec in smoke testsVerification
pnpm typecheck— cleanpnpm exec biome check— cleanpnpm test— 3912 passed, 0 failedSupersedes closed PR #3620
Fixes #4009