tailwindlabs / headlessui

Completely unstyled, fully accessible UI components, designed to integrate beautifully with Tailwind CSS.
https://headlessui.com
MIT License
25.81k stars 1.07k forks source link

Add missing `NODE_ENV` checks to `ComboBox` #3487

Closed panusoi closed 4 days ago

panusoi commented 6 days ago

This PR fixes an issue where a virtualized ComboBox crashed if there was global process variable without env property. The issue was caused by a missing process.env.NODE_ENV === 'test' check which caused the branch to end up in the released version.

vercel[bot] commented 6 days ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
headlessui-react ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 24, 2024 4:55pm
headlessui-vue ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 24, 2024 4:55pm
RobinMalfait commented 4 days ago

Hey!

Thank you for the PR, I did implement an alternative by getting rid of the process entirely. We already checked whether process was available or not. I do have a question, in what environment was process available but process.env is not?

Either way, we got rid of the entire check in #3495 and will be available in the next release.

You can already try it using:

Thanks again for your initial work!

panusoi commented 4 days ago

Hi,

I encountered this issue when I was running the Cypress component tests. The environment was Typescript + Cypress + React + Vite. For some reason Cypress exposes an empty process object.

I ran my tests with @headlessui/react@insiders and everything works great. Thanks!

RobinMalfait commented 3 days ago

@panusoi Aha good to know, thanks for the info. Glad it's working with the insiders build!