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

There is a problem in Promise when I using useUrlSearchParams #2164

Closed
7 tasks done
waldonUB opened this issue Sep 3, 2022 · 1 comment · Fixed by #2165
Closed
7 tasks done

There is a problem in Promise when I using useUrlSearchParams #2164

waldonUB opened this issue Sep 3, 2022 · 1 comment · Fixed by #2165

Comments

@waldonUB
Copy link
Contributor

waldonUB commented Sep 3, 2022

Describe the bug

Hi there.
There is a problem in Promise when I use the useUrlSearchParams API. The reason for this problem is that window.history.replaceState use frequently in Promise is not recommended.

Reproduction

Steps

  1. Keep pressing the button to switch pages about 30 times
  2. Then a warning appears
  3. Click the button again and the page will crash

image

Preview

https://1eylfj.csb.app/?page=1

solution

  • add a param in UseUrlSearchParamsOptions
  • if the param is true, it does not perform the write function

image

Reproduction

https://1eylfj.csb.app/?page=1

System Info

System:
    OS: Windows 10 10.0.19043
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz
    Memory: 2.99 GB / 15.80 GB
  Binaries:
    Node: 16.15.1 - D:\waldonDev\nodejs\node.EXE
    Yarn: 1.22.19 - D:\waldonDev\nodejs\npm_global\yarn.CMD
    npm: 8.11.0 - D:\waldonDev\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.19041.1266.0), Chromium (104.0.1293.63)
    Internet Explorer: 11.0.19041.1566

Used Package Manager

yarn

Validations

@waldonUB
Copy link
Contributor Author

waldonUB commented Sep 3, 2022

Sometimes, I just want to get the url params instead of execute window.history.replaceState

@sxzz sxzz closed this as completed in #2165 Sep 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant