Skip to content

Conversation

@emir-karabeg
Copy link
Collaborator

Summary

Aligned invite page styling and added better error handling.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Other: ___________

Testing

Solo.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Jan 3, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Review Updated (UTC)
docs Skipped Skipped Jan 3, 2026 3:42am

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 3, 2026

Greptile Summary

Aligned invite page styling with the rest of the auth flow by adopting AuthBackground component and matching button styles from the navigation component. Significantly improved error handling by introducing structured error types (InviteError interface), comprehensive error code mapping, and an parseApiError function that intelligently matches error messages and HTTP status codes. Enhanced user experience with contextual error states that provide appropriate actions (sign-in prompts for auth errors, retry buttons for network issues, organization management for membership conflicts).

Confidence Score: 4/5

  • Safe to merge with minor observational notes about unused properties
  • The code demonstrates good architectural improvements with structured error handling and consistent styling. The main issue is the unused requiresSignup property which reduces the score slightly, but this doesn't affect functionality. The error parsing logic is well-ordered (specific patterns before general ones), addressing previous concerns about the 'already a member' check order.
  • No files require special attention

Important Files Changed

Filename Overview
apps/sim/app/invite/[id]/invite.tsx Major refactor adding structured error handling with error codes, types, and parsing logic; improved auth-related error flows
apps/sim/app/invite/components/layout.tsx Updated to use AuthBackground component and aligned styling with auth pages; added hideAuthButtons prop to Nav
apps/sim/app/invite/components/status-card.tsx Removed complex icon mapping logic, simplified button styling with inline gradient classes, improved hover states with ArrowRight/ChevronRight

Sequence Diagram

sequenceDiagram
    participant User
    participant InvitePage
    participant API
    participant ErrorHandler
    participant StatusCard

    User->>InvitePage: Visit /invite/[id]
    
    alt Error in URL params
        InvitePage->>ErrorHandler: Parse error reason
        ErrorHandler->>StatusCard: Display error state
        StatusCard->>User: Show error with actions
    else Valid invite ID
        InvitePage->>API: Fetch workspace invitation
        
        alt Workspace invite found
            API-->>InvitePage: Workspace invite data
            InvitePage->>StatusCard: Display workspace invite
        else Workspace 404
            InvitePage->>API: Fetch organization invitation
            
            alt Organization invite found
                API-->>InvitePage: Organization invite data
                InvitePage->>API: Check active organization
                
                alt Already in organization
                    InvitePage->>ErrorHandler: already-in-organization
                    ErrorHandler->>StatusCard: Show "leave org first" error
                else Not in organization
                    InvitePage->>StatusCard: Display org invite details
                    User->>InvitePage: Accept invitation
                    InvitePage->>API: POST /accept-invite
                    
                    alt Success
                        API-->>InvitePage: Success response
                        InvitePage->>StatusCard: Show success state
                    else API Error
                        API-->>InvitePage: Error response
                        InvitePage->>ErrorHandler: Parse API error
                        ErrorHandler->>StatusCard: Show contextual error
                    end
                end
            else Organization invite error
                API-->>InvitePage: Error response
                InvitePage->>ErrorHandler: Parse error (status + message)
                ErrorHandler->>StatusCard: Show error with retry/auth options
            end
        else Workspace invite error (non-404)
            API-->>InvitePage: Error response
            InvitePage->>ErrorHandler: Parse error with status code
            ErrorHandler->>StatusCard: Show error with actions
        end
    end
    
    Note over ErrorHandler: parseApiError checks:<br/>1. Message patterns (specific first)<br/>2. HTTP status codes<br/>3. Returns error code
    
    Note over StatusCard: Renders based on error.code:<br/>- requiresAuth → show sign-in<br/>- canRetry → show retry button<br/>- already-in-org → show leave org action
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

4 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

code: InviteErrorCode
message: string
requiresAuth?: boolean
requiresSignup?: boolean
Copy link
Contributor

Choose a reason for hiding this comment

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

style: requiresSignup is defined but never used in the error handling logic

Suggested change
requiresSignup?: boolean
requiresAuth?: boolean
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/sim/app/invite/[id]/invite.tsx
Line: 34:34

Comment:
**style:** `requiresSignup` is defined but never used in the error handling logic

```suggestion
  requiresAuth?: boolean
```

How can I resolve this? If you propose a fix, please make it concise.

Comment on lines 154 to 155
if (errorMessage.includes('already a member')) return 'already-member'
if (errorMessage.includes('already a member of an organization')) return 'already-in-organization'
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: check for 'already a member of an organization' will never execute because 'already a member' on line 154 matches first

Suggested change
if (errorMessage.includes('already a member')) return 'already-member'
if (errorMessage.includes('already a member of an organization')) return 'already-in-organization'
if (errorMessage.includes('already a member of an organization')) return 'already-in-organization'
if (errorMessage.includes('already a member')) return 'already-member'
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/sim/app/invite/[id]/invite.tsx
Line: 154:155

Comment:
**logic:** check for `'already a member of an organization'` will never execute because `'already a member'` on line 154 matches first

```suggestion
  if (errorMessage.includes('already a member of an organization')) return 'already-in-organization'
  if (errorMessage.includes('already a member')) return 'already-member'
```

How can I resolve this? If you propose a fix, please make it concise.

@emir-karabeg
Copy link
Collaborator Author

@greptile

@emir-karabeg emir-karabeg merged commit 8d15219 into staging Jan 3, 2026
10 checks passed
@emir-karabeg emir-karabeg deleted the improvement/invite branch January 3, 2026 03:45
waleedlatif1 added a commit that referenced this pull request Jan 3, 2026
…ext menu (#2672)

* feat(logs-context-menu): consolidated logs utils and types, added logs record context menu (#2659)

* feat(email): welcome email; improvement(emails): ui/ux (#2658)

* feat(email): welcome email; improvement(emails): ui/ux

* improvement(emails): links, accounts, preview

* refactor(emails): file structure and wrapper components

* added envvar for personal emails sent, added isHosted gate

* fixed failing tests, added env mock

* fix: removed comment

---------

Co-authored-by: waleed <walif6@gmail.com>

* fix(logging): hitl + trigger dev crash protection (#2664)

* hitl gaps

* deal with trigger worker crashes

* cleanup import strcuture

* feat(imap): added support for imap trigger (#2663)

* feat(tools): added support for imap trigger

* feat(imap): added parity, tested

* ack PR comments

* final cleanup

* feat(i18n): update translations (#2665)

Co-authored-by: waleedlatif1 <waleedlatif1@users.noreply.github.com>

* fix(grain): updated grain trigger to auto-establish trigger (#2666)

Co-authored-by: aadamgough <adam@sim.ai>

* feat(admin): routes to manage deployments (#2667)

* feat(admin): routes to manage deployments

* fix naming fo deployed by

* feat(time-picker): added timepicker emcn component, added to playground, added searchable prop for dropdown, added more timezones for schedule, updated license and notice date (#2668)

* feat(time-picker): added timepicker emcn component, added to playground, added searchable prop for dropdown, added more timezones for schedule, updated license and notice date

* removed unused params, cleaned up redundant utils

* improvement(invite): aligned styling (#2669)

* improvement(invite): aligned with rest of app

* fix(invite): error handling

* fix: addressed comments

---------

Co-authored-by: Emir Karabeg <78010029+emir-karabeg@users.noreply.github.com>
Co-authored-by: Vikhyath Mondreti <vikhyathvikku@gmail.com>
Co-authored-by: waleedlatif1 <waleedlatif1@users.noreply.github.com>
Co-authored-by: Adam Gough <77861281+aadamgough@users.noreply.github.com>
Co-authored-by: aadamgough <adam@sim.ai>
waleedlatif1 pushed a commit that referenced this pull request Jan 4, 2026
* improvement(invite): aligned with rest of app

* fix(invite): error handling

* fix: addressed comments
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