Skip to content

Conversation

@ameer2468
Copy link
Contributor

@ameer2468 ameer2468 commented Nov 3, 2025

Summary by CodeRabbit

  • Refactor
    • Improved navigation performance by enabling link prefetching across dashboard navigation.
    • Updated organization removal to a soft-delete workflow (now preserves deletions rather than permanently removing).
    • UI now reflects the soft-delete state (button labels, spinners and disabled states show pending soft-delete actions).

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 3, 2025

Walkthrough

Renames organization deletion to "soft delete" through frontend, backend RPC, service, and domain schema; also enables Next.js Link prefetch on several navbar components. No functional behavior changes beyond RPC/name updates and Link prefetch toggles.

Changes

Cohort / File(s) Summary
Navbar — Link prefetch
apps/web/app/(org)/dashboard/_components/Navbar/Items.tsx, apps/web/app/(org)/dashboard/_components/Navbar/SpacesList.tsx, apps/web/app/(org)/dashboard/_components/Navbar/Top.tsx
Changed Next.js Link usages to set prefetch={true} (was false) on navigation/menu items. No other logic changes.
Frontend — Delete org dialog
apps/web/app/(org)/dashboard/settings/organization/components/DeleteOrgDialog.tsx
Renamed mutation hook variable from deleteOrg to softDeleteOrg, updated RPC call reference to soft-delete, and switched UI handlers/spinner/button logic to use softDeleteOrg. Removed unused Organisation import.
Backend RPC — rename
packages/web-backend/src/Organisations/OrganisationsRpcs.ts
Renamed RPC handler OrganisationDeleteOrganisationSoftDelete; updated call from orgs.deleteOrg(data.id) to orgs.softDelete(data.id); preserved existing error handling.
Service layer — rename
packages/web-backend/src/Organisations/index.ts
Renamed exported service function deleteOrgsoftDelete, updated Effect.fn identifier and returned payload keys accordingly. Internal tombstone logic unchanged.
Domain schema / RPC surface
packages/web-domain/src/Organisation.ts
Removed OrganisationDelete schema/type; renamed RPC entry to OrganisationSoftDelete and replaced usage of the named schema with an inline { id: OrganisationId } payload.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant UI as Frontend UI
  participant RPC as Organisations RPC
  participant Svc as Organisations Service
  participant DB as Database

  rect rgba(200,230,255,0.3)
  UI->>RPC: call OrganisationSoftDelete({ id })
  note right of RPC #D0F0C0: RPC handler maps to service
  end

  RPC->>Svc: service.softDelete(id)
  Svc->>DB: softDelete(orgId)  -- mark tombstone / set deleted flag
  DB-->>Svc: success / error
  Svc-->>RPC: result / error (wrapped)
  RPC-->>UI: response (success or InternalError{type: "database"})
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Review points:
    • Ensure all RPC/service rename references updated across the codebase (search for remaining deleteOrg/OrganisationDelete).
    • Verify domain schema/IDL changes don't break client/server RPC bindings.
    • Confirm UI mutation wiring and spinner/state checks correctly reflect the new hook naming.

Possibly related PRs

Poem

🐰
I nibbled names in code tonight, so gentle and neat,
“Soft delete” I whispered, no harsh retreat.
Links now prefetch, they hop fast and true,
From UI to RPC, the path skips through.
A carrot for tests — hop on, review! 🥕

Pre-merge checks and finishing touches

✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title accurately captures the two main changes in the changeset: (1) RPC cleanup by renaming OrganisationDelete to OrganisationSoftDelete and updating the underlying method calls across multiple files, and (2) enabling prefetch on Next.js Link components in the Navbar components. The title is concise, clear, and specific enough for teammates to understand the primary changes when scanning history.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch cleanup-rpc-org

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

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
apps/web/app/(org)/dashboard/_components/Navbar/Top.tsx (2)

326-331: Consider conditionally applying prefetch based on href validity.

The prefetch={true} is now applied to all menu items, including those that use href="#" as a fallback (e.g., "Chat Support", "Download App", "Sign Out", "Upgrade to Pro"). While Next.js should handle this gracefully, it's wasteful to prefetch placeholder links that don't perform actual navigation.

Apply this diff to make prefetch conditional:

 <Link
   className="flex gap-2 items-center w-full"
   href={href ?? "#"}
-  prefetch={true}
+  prefetch={href !== undefined && href !== "#"}
   onClick={onClick}
 >

Alternatively, update the MenuItem interface to accept an optional prefetch prop so callers can control it explicitly based on whether the item has a real navigation href.


187-246: Optional: Update useMemo dependencies to include user.isPro.

The useMemo hook has an empty dependency array but references user.isPro (line 205). If the user upgrades to Pro during their session, the menu items won't update to hide the "Upgrade to Pro" option.

Apply this diff to fix the dependency array:

   ],
-  []);
+  [user.isPro]);

Note: buildEnv.NEXT_PUBLIC_IS_CAP is likely a constant and doesn't need to be included in dependencies.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7daa964 and 01e1a8a.

📒 Files selected for processing (1)
  • apps/web/app/(org)/dashboard/_components/Navbar/Top.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx}: Use a 2-space indent for TypeScript code.
Use Biome for formatting and linting TypeScript/JavaScript files by running pnpm format.

Files:

  • apps/web/app/(org)/dashboard/_components/Navbar/Top.tsx
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx,js,jsx}: Use kebab-case for filenames for TypeScript/JavaScript modules (e.g., user-menu.tsx).
Use PascalCase for React/Solid components.

Files:

  • apps/web/app/(org)/dashboard/_components/Navbar/Top.tsx
apps/web/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

On the client, always use useEffectQuery or useEffectMutation from @/lib/EffectRuntime; never call EffectRuntime.run* directly in components.

Files:

  • apps/web/app/(org)/dashboard/_components/Navbar/Top.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Build Desktop (aarch64-apple-darwin, macos-latest)
  • GitHub Check: Build Desktop (x86_64-pc-windows-msvc, windows-latest)
  • GitHub Check: Analyze (rust)

@ameer2468 ameer2468 merged commit 722fd2f into main Nov 3, 2025
17 checks passed
@ameer2468 ameer2468 deleted the cleanup-rpc-org branch November 3, 2025 14:27
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.

2 participants