supabase-community / auth-ui

Pre-built Auth UI for React
https://supabase.com/docs/guides/auth/auth-helpers/auth-ui
MIT License
478 stars 120 forks source link

Update `@supabase/auth-ui-react` to use `react` and `react-dom` as `peerDependencies` #195

Open Alex-Yakubovsky opened 1 year ago

Alex-Yakubovsky commented 1 year ago

Chore

Update @supabase/auth-ui-react to have react and react-dom as peer dependencies.

I'm currently using react@next as dependency for my project. Installing @supabase/auth-ui-react ends up also including react@18.2.0. Here's the out for pnpm why react for my project:

dependencies:
@heroicons/react 2.0.18
└── react 18.3.0-canary-493f72b0a-20230727 peer
@remix-run/react 1.19.1
├── react 18.3.0-canary-493f72b0a-20230727 peer
├─┬ react-dom 18.3.0-canary-493f72b0a-20230727 peer
│ └── react 18.3.0-canary-493f72b0a-20230727 peer
└─┬ react-router-dom 6.14.2
  ├── react 18.3.0-canary-493f72b0a-20230727 peer
  ├─┬ react-dom 18.3.0-canary-493f72b0a-20230727 peer
  │ └── react 18.3.0-canary-493f72b0a-20230727 peer
  └─┬ react-router 6.14.2
    └── react 18.3.0-canary-493f72b0a-20230727 peer
@supabase/auth-ui-react 0.4.2
├── react 18.2.0
└─┬ react-dom 18.2.0
  └── react 18.2.0 peer
react 18.3.0-canary-493f72b0a-20230727
react-dom 18.3.0-canary-493f72b0a-20230727
└── react 18.3.0-canary-493f72b0a-20230727 peer

This ends up crashing my app with an Invalid hook call error due to multiple copies of React.

Describe the chore

Additional context

For others who need a workaround; if you're using pnpm you can use the overrides functionality by updating your root package.json with

{
  // ...
  "pnpm": {
    "@supabase/auth-ui-react>react": "next",
    "@supabase/auth-ui-react>react-dom": "next"
  }
}

I'd be happy to create a PR for this, guidelines just ask for contributors to submit an issue first.