Skip to content

fix(desktop): replace useActiveOrganization with collections data#881

Merged
saddlepaddle merged 1 commit into
mainfrom
fix-fetch
Jan 21, 2026
Merged

fix(desktop): replace useActiveOrganization with collections data#881
saddlepaddle merged 1 commit into
mainfrom
fix-fetch

Conversation

@saddlepaddle
Copy link
Copy Markdown
Collaborator

@saddlepaddle saddlepaddle commented Jan 21, 2026

Summary

  • Remove unused name field from invitations schema (was causing Better Auth query failures)
  • Replace useActiveOrganization() with collections data in MembersSettings
  • Use email directly for new user name when accepting invitations

Test plan

  • Verify members settings page loads without errors
  • Verify pending invitations section shows correctly
  • Verify invite member dialog works

Summary by CodeRabbit

  • Refactoring
    • Updated user account creation during invitation acceptance to use email-based naming.
    • Removed name field from invitations throughout the system and API responses.

✏️ Tip: You can customize this high-level summary in your review settings.

- Remove unused `name` field from invitations schema
- Use collections to fetch organization data in MembersSettings
- Use email directly for new user name in accept-invitation
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 21, 2026

📝 Walkthrough

Walkthrough

The invitation system is refactored by removing the name field from the database schema, API responses, and user creation logic. The new user username now defaults to the email address. The MembersSettings component is updated to fetch organization data via local queries instead of using the activeOrganization hook.

Changes

Cohort / File(s) Summary
Invitation System Updates
packages/db/src/schema/auth.ts, packages/auth/src/lib/accept-invitation-endpoint.ts, packages/trpc/src/router/organization/organization.ts
Removes the name field from the invitations table schema, API endpoint response, and user creation logic. Simplifies new user username derivation to use invitation.email directly.
Component Data Fetching Refactor
apps/desktop/src/renderer/routes/_authenticated/settings/members/components/MembersSettings/MembersSettings.tsx
Replaces useActiveOrganization hook with inline live query fetching organizations from collections. Derives organization by matching activeOrganizationId and sources current user role from pre-fetched members array instead of activeOrg.members.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A name field hops away with grace,
Email takes its rightful place,
Components now query their own way,
Cleaner flows throughout the day!
🌟

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The description covers key changes and includes a test plan, but lacks required template sections like Related Issues, Type of Change, and Screenshots. Complete the PR description by adding Type of Change (Refactor), Related Issues if applicable, and confirming the testing sections match the template structure for consistency.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title directly and clearly describes the main change: replacing useActiveOrganization with collections data in the desktop renderer, which is the primary refactoring across the changeset.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 21, 2026

🧹 Preview Cleanup Complete

The following preview resources have been cleaned up:

  • ✅ Neon database branch
  • ✅ Electric Fly.io app

Thank you for your contribution! 🎉

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