Skip to content

Fix: Completion screen: personalized invite link for 'Invite a team member'#686

Open
Kirtan-pc wants to merge 2 commits into
Coder-s-OG-s:mainfrom
Kirtan-pc:completion-screen
Open

Fix: Completion screen: personalized invite link for 'Invite a team member'#686
Kirtan-pc wants to merge 2 commits into
Coder-s-OG-s:mainfrom
Kirtan-pc:completion-screen

Conversation

@Kirtan-pc

Copy link
Copy Markdown
Contributor

Summary

The "Invite a team member" / "Invite contributor" button now generates a personalized invite link (/invite?ref={handle}) that can be copied to clipboard, so whoever clicks it can be tied back to the inviter.

Type of Change

  • Bug fix
  • New feature
  • UI / UX improvement
  • Refactor
  • Documentation
  • Other

Related Issue

Closes #680

What was changed?

  • Added getMyGithubHandle server action in src/app/actions/maintainer/invites.ts
  • Exported it from src/app/actions/maintainer/index.ts
  • Added "Copy invite link" button to the invite modal in src/app/(app)/maintainer/invite-contributor-button.tsx

Checklist

  • My code follows the project structure and conventions
  • I tested this locally (npm run dev)
  • No hardcoded secrets or credentials
  • I have updated documentation if needed

@vercel

vercel Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

@Kirtan-pc is attempting to deploy a commit to the codersogs-3057's projects Team on Vercel.

A member of the Team first needs to authorize it.

@jakharmonika364 jakharmonika364 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is a great addition! Tying invites back to the inviter makes a lot of sense.

I've found a couple of edge cases that we should handle before merging this:

1. Async Clipboard API Error Handling
Calling navigator.clipboard.writeText() after an await network request can sometimes be blocked by browsers (especially Safari) if the network request takes too long, because it loses the "active user gesture" context. If it gets blocked or fails, writeText throws an error which currently isn't caught, leaving the button stuck in the "Generating..." state.

Could you wrap the clipboard logic in a try/catch block?

    const link = `${process.env.NEXT_PUBLIC_APP_URL || 'https://mergeship.dev'}/invite?ref=${res.data}`;
    
    try {
      await navigator.clipboard.writeText(link);
      setLinkCopied(true);
    } catch (err) {
      setError('Failed to copy to clipboard. Please try again.');
    } finally {
      setGeneratingLink(false);
      setTimeout(() => {
        setLinkCopied(false);
        setError(null);
      }, 2000);
    }

@jakharmonika364 jakharmonika364 added the Needs author reply Author need to reply label Jul 12, 2026
@Kirtan-pc

Copy link
Copy Markdown
Contributor Author

Hey @jakharmonika364,
I have implemented the requested changes.
Could you please review it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs author reply Author need to reply

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Completion screen: personalized invite link for 'Invite a team member'

2 participants