Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supabase example has duplicate utils for cn.ts #73942

Closed
1 task done
damiensedgwick opened this issue Dec 14, 2024 · 3 comments · Fixed by #74065
Closed
1 task done

Supabase example has duplicate utils for cn.ts #73942

damiensedgwick opened this issue Dec 14, 2024 · 3 comments · Fixed by #74065
Labels
examples Issue was opened via the examples template. locked

Comments

@damiensedgwick
Copy link
Contributor

damiensedgwick commented Dec 14, 2024

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

bunx next info
/bin/sh: yarn: command not found
/bin/sh: pnpm: command not found

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.2.0: Fri Dec  6 19:00:33 PST 2024; root:xnu-11215.61.5~2/RELEASE_ARM64_T8122
  Available memory (MB): 8192
  Available CPU cores: 8
Binaries:
  Node: 20.13.1
  npm: 10.5.2
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  next: 15.1.0 // Latest available version is detected (15.1.0).
  eslint-config-next: N/A
  react: 18.3.1
  react-dom: 18.3.1
  typescript: 5.6.3
Next.js Config:
  output: N/A


### Which example does this report relate to?

with-supabase

### What browser are you using? (if relevant)

_No response_

### How are you deploying your application? (if relevant)

_No response_

### Describe the Bug

There is duplication of code for the classNames utility. It currently exists in 2 places with this example. Both in `lib/utils.ts` and in `utils/cn.ts` when creating a new project using `bunx create-next-app -e with-supabase`.

### Expected Behavior

It should only be declared in one location.

### To Reproduce

Create a new project using `bunx create-next-app -e with-supabase` and check the 2 locations shared in the description.
@damiensedgwick damiensedgwick added the examples Issue was opened via the examples template. label Dec 14, 2024
@samcx samcx added the please use the correct issue template The issue is using the wrong issue template. label Dec 16, 2024
@samcx samcx reopened this Dec 16, 2024
@vercel vercel deleted a comment from github-actions bot Dec 16, 2024
@samcx samcx removed the please use the correct issue template The issue is using the wrong issue template. label Dec 16, 2024
@damiensedgwick
Copy link
Contributor Author

damiensedgwick commented Dec 17, 2024

Hey @samcx! I see you've been looking at the labels.

I'm happy to help fix this example, but it would be great to confirm how we want to proceed.

In my local setup, I removed the utils directory and called the cn helper from the lib folder. However, I noticed that when a Shadcn component is installed, it expects the cn function to be in utils/cn instead of lib/cn.

It seems like we might need to update components.json to point to the correct location or stick with using utils/cn.

Let me know your thoughts!

@samcx
Copy link
Member

samcx commented Dec 17, 2024

@damiensedgwick Sorry was testing the label and realized this was using the correct issue template :lol:

Always feel free to open a PR and ping me on the PR (no need to ask permission for opening PRs)! I would always double-check if there is an open PR(s) already to fix the issue.

pull bot pushed a commit to l3dlp-sandbox/next.js that referenced this issue Dec 18, 2024
This pull request removes duplication of a utility function within the
`with-supabase` example as mentioned in the following issue vercel#73942 - I
removed the duplicated code from the `utils` directory as when shadcn
installs a new component, that component will look for the helper
function in `lib/utils.ts` and forcing users to update every component
after installation or modify any config files for shadcn seems like a
worse DX.

- Fixes vercel#73942

---------

Co-authored-by: samcx <sam@vercel.com>
Copy link
Contributor

github-actions bot commented Jan 2, 2025

This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot added the locked label Jan 2, 2025
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 2, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
examples Issue was opened via the examples template. locked
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants