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

Error: @location-state/next with Next.js@v14~ #343

Closed
AkifumiSato opened this issue May 9, 2024 · 1 comment
Closed

Error: @location-state/next with Next.js@v14~ #343

AkifumiSato opened this issue May 9, 2024 · 1 comment
Assignees
Labels
bug Something isn't working @location-state/next

Comments

@AkifumiSato
Copy link
Contributor

Next.jsのv14系(おそらくv14以降)でレンダリング時にエラーが発生する

  • next: v14.1.4
  • @location-state/next: v1.0.1(pnpm link)
Unhandled Runtime Error
TypeError: Cannot read properties of null (reading 'useState')

Source
javascript/oss/location-state/packages/location-state-next/dist/index.mjs (35:20) @ useNextPagesSyncer

  33 | function useNextPagesSyncer() {
  34 |   const router = useRouter();
> 35 |   const [syncer] = React.useState(() => new NextPagesSyncer(router));
     |                    ^
  36 |   const needNotify = React.useRef(false);
  37 |   if (needNotify.current) {
  38 |     syncer.notify();

スクリーンショット 2024-05-09 17 05 52

@AkifumiSato AkifumiSato added the bug Something isn't working label May 9, 2024
@AkifumiSato AkifumiSato self-assigned this May 9, 2024
@AkifumiSato
Copy link
Contributor Author

v1.1.0をインストールして検証しましたが再現せず。
本事象はpnpm add {local repository path}してたからかもしれません。
(似たようなことが前もあったような...?)
一旦closeし、publish済みのパッケージで再現することがあればre openします。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working @location-state/next
Projects
None yet
Development

No branches or pull requests

1 participant