chakra-react-select icon indicating copy to clipboard operation
chakra-react-select copied to clipboard

[BUG] useChakraSelectProps not working

Open JenangMaker opened this issue 7 months ago • 1 comments

Description

When using useChakraSelectProps on freshly installed next js and latest chakra ui resulting error useContext returned undefined. Seems you forgot to wrap component within <ChakraProvider />

chakra-react-select Version

6.1.0

Link to Reproduction

https://codesandbox.io/p/github/JenangMaker/test-bug-chakra-select

TypeScript?

  • [ ] Yes I use TypeScript

Steps to reproduce

  1. Create fresh next js template
  2. install chakra ui
  3. install chakra react select
  4. create a select with useChakraSelectProps

Operating System

  • [ ] macOS
  • [x] Windows
  • [ ] Linux
  • [ ] iOS/iPadOS
  • [ ] Android

Package Manager

NPM

Additional Information

Using

  • ChakraUI 3.17.0
  • chakra-react-select 6.1.0
  • NextJS 15.3.1

JenangMaker avatar May 05 '25 07:05 JenangMaker

I took a look, and I think there's something wrong with your sandbox environment. I can't tell exactly what it is, but I can't reproduce the issue when I set up my own instance of Next.js locally. I tried it specifically using the Chakra UI Next.js Pages example. One thing that does appear to be missing in your sandbox is the next-themes provider, which CRS uses to pull the styles from, but I'm not sure if that's the only thing, because adding that didn't seem to fix the issue for me.

I'll take another look later when I have time.

csandman avatar May 10 '25 03:05 csandman

I'm having a similar issue. Interestingly, if i navigate from a page that doesn't have a select input to a page that does I don't get an error. It's only if I go directly to the page with the select or reload the page that the error pops up.

JacobGalati avatar Jul 07 '25 22:07 JacobGalati

@JacobGalati Is it only for useChakraSelectProps, or just for the normal Select component?

csandman avatar Jul 08 '25 17:07 csandman

There have been no new updates on this, so I'm going to close it until someone else has an issue with this

csandman avatar Nov 13 '25 02:11 csandman