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

Cannot link from page where useQueryState is used #491

Closed
camin-mccluskey opened this issue Feb 9, 2024 · 1 comment
Closed

Cannot link from page where useQueryState is used #491

camin-mccluskey opened this issue Feb 9, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@camin-mccluskey
Copy link

camin-mccluskey commented Feb 9, 2024

Context

What's your version of nuqs?

"nuqs": "^1.16.1"

Next.js information (obtained by running next info):

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.0.0: Fri Sep 15 14:43:05 PDT 2023; root:xnu-10002.1.13~1/RELEASE_ARM64_T6020
Binaries:
  Node: 20.11.0
  npm: 10.2.4
  Yarn: N/A
  pnpm: 8.14.1
Relevant Packages:
  next: 14.1.1-canary.45
  eslint-config-next: 14.1.0
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.3.3
Next.js Config:
  output: N/A

Are you using:

  • ❌ The app router
  • ✅ The pages router
  • ❌ The basePath option in your Next.js config
  • ❌ The experimental windowHistorySupport flag in your Next.js config

Description

Suffering router abort fetch errors from a page where nuqs is used. This occurs when the page is SSG and SSR. More details in this issue comment.

Update: setting the throttleMs option to 200ms "solves" the issue for me.

  const [comparisonProductApplicationIds, setComparisonProductApplicationIds] = useQueryState(
    'comparisonPAIds',
    parseAsArrayOf(parseAsString).withDefault([]).withOptions({
      throttleMs: 200,
    }),
  )

Reproduction

@camin-mccluskey
Copy link
Author

Issue was due to a bad useEffect call which was rerendering the page

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

No branches or pull requests

1 participant