dubinc/dub

Bug: InviteCode is Undefined

Closed this issue · 2 comments

Issue: InviteCode is Undefined

Screenshot 2024-04-21 at 12 56 54 AM

Description

The InviteCode property is undefined in the invite-code-modal.tsx component. This component uses the useWorkspace() hook, which returns the inviteCode value. However, the inviteCode appears to be undefined.

Investigation

After investigating the codebase, it seems that the /api/workspace route is responsible for returning the inviteCode. This route's response is likely the source of the undefined inviteCode value.

Steps to Reproduce

Screenshot 2024-04-21 at 12 57 48 AM

  1. Navigate to https://app.dub.co//settings/people
  2. Click on the "Link" button.
  3. Open the browser console.
  4. Observe the InviteCode property being logged as undefined.

Expected Behavior

The InviteCode property should be a valid string value returned from the /api/workspace route.

Possible Solutions

  • Ensure that the /api/workspace route is returning the correct inviteCode value.
  • Check if the useWorkspace() hook is correctly handling and returning the inviteCode value.
  • Implement error handling and fallback mechanisms in the invite-code-modal.tsx component for cases where the inviteCode is undefined.

Additional Context

invite-code-modal.tsx:22

Screenshot 2024-04-21 at 1 02 06 AM

Thank you so much for the detailed bug report @BharathxD! We've just merged a PR that fixes this (will be deployed in a few minutes)