Skip to content

Commit f424aa2

Browse files
authored
Add client-only to mark everything as client components (#1981)
* add `client-only` to mark everything as client components This should improve the error messages when using Headless UI in a Next.js 13+ repo instead of getting a cryptic error message that `createContext` doesn't exist. * update changelog
1 parent dce2a1a commit f424aa2

File tree

4 files changed

+11
-0
lines changed

4 files changed

+11
-0
lines changed

packages/@headlessui-react/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313
- Expose `close` function for `Menu` and `Menu.Item` components ([#1897](https://github.com/tailwindlabs/headlessui/pull/1897))
1414
- Fix `useOutsideClick`, add improvements for ShadowDOM ([#1914](https://github.com/tailwindlabs/headlessui/pull/1914))
1515
- Fire `<Combobox.Input>`'s `onChange` handler when changing the value internally ([#1916](https://github.com/tailwindlabs/headlessui/pull/1916))
16+
- Add `client-only` to mark everything as client components ([#1981](https://github.com/tailwindlabs/headlessui/pull/1981))
1617

1718
### Added
1819

packages/@headlessui-react/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,8 @@
4949
"react": "^18.0.0",
5050
"react-dom": "^18.0.0",
5151
"snapshot-diff": "^0.8.1"
52+
},
53+
"dependencies": {
54+
"client-only": "^0.0.1"
5255
}
5356
}

packages/@headlessui-react/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import 'client-only'
2+
13
export * from './components/combobox/combobox'
24
export * from './components/dialog/dialog'
35
export * from './components/disclosure/disclosure'

yarn.lock

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1595,6 +1595,11 @@ cli-truncate@^3.1.0:
15951595
slice-ansi "^5.0.0"
15961596
string-width "^5.0.0"
15971597

1598+
client-only@^0.0.1:
1599+
version "0.0.1"
1600+
resolved "https://registry.yarnpkg.com/client-only/-/client-only-0.0.1.tgz#38bba5d403c41ab150bff64a95c85013cf73bca1"
1601+
integrity sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==
1602+
15981603
cliui@^6.0.0:
15991604
version "6.0.0"
16001605
resolved "https://registry.yarnpkg.com/cliui/-/cliui-6.0.0.tgz#511d702c0c4e41ca156d7d0e96021f23e13225b1"

0 commit comments

Comments
 (0)