Skip to content

Fix: Generate slugs for users created during app submission#17

Draft
Copilot wants to merge 2 commits intofeat/personal-sitefrom
copilot/sub-pr-13-another-one
Draft

Fix: Generate slugs for users created during app submission#17
Copilot wants to merge 2 commits intofeat/personal-sitefrom
copilot/sub-pr-13-another-one

Conversation

Copy link
Contributor

Copilot AI commented Feb 12, 2026

Users created in api/submissions.ts were inserted with slug: null, permanently breaking profile routing since api/users.ts only generates slugs for new users, not updates.

Changes

  • Import slug utilities (generateSlugFromEmail, generateUniqueSlug) in api/submissions.ts
  • Apply same slug generation logic as api/users.ts when creating placeholder users

Before

await db.insert(users).values({
  id: submittedByUserId,
  email: submittedByEmail,
  name: null,
  slug: null,  // ❌ breaks routing
});

After

const baseSlug = generateSlugFromEmail(submittedByEmail);
const existingSlugsQuery = await db
  .select({ slug: users.slug })
  .from(users)
  .where(eq(users.slug, baseSlug));

const existingSlugs = existingSlugsQuery.map(row => row.slug).filter(Boolean) as string[];
const uniqueSlug = generateUniqueSlug(baseSlug, existingSlugs);

await db.insert(users).values({
  id: submittedByUserId,
  email: submittedByEmail,
  name: null,
  slug: uniqueSlug,  // ✅ routing works
});

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI mentioned this pull request Feb 12, 2026
@vercel
Copy link

vercel bot commented Feb 12, 2026

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

Project Deployment Actions Updated (UTC)
string-v2 Ready Ready Preview, Comment Feb 12, 2026 4:06pm

Co-authored-by: ghostleek <44336310+ghostleek@users.noreply.github.com>
Copilot AI changed the title [WIP] Update personal site PR based on feedback Fix: Generate slugs for users created during app submission Feb 12, 2026
Copilot AI requested a review from ghostleek February 12, 2026 16:05
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