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

[Chrome Extension] console debug mode will crash crash your app when using localStorage.setItem("debug", "nuqs") #808

Open
dejoma opened this issue Dec 13, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@dejoma
Copy link

dejoma commented Dec 13, 2024

Context

    "nuqs": "^2.2.3",

What framework are you using?

  • ✅ Next.js (app router)

Which version of your framework are you using?

14.2.20

Description & reproduction

On localhost; go to console and do:

localStorage.setItem("debug", "nuqs")

Then go to any page with parameters that have default value. For me it was a boolean parsen "open" with default false. Then if you go to any page it will give "cannot parse null to string";

image
@dejoma dejoma added the bug Something isn't working label Dec 13, 2024
@franky47
Copy link
Member

I see the error comes from a Chrome Extension, any idea which one it might be?

@franky47 franky47 changed the title console debug mode will crash crash your app when using localStorage.setItem("debug", "nuqs") [Chrome Extension] console debug mode will crash crash your app when using localStorage.setItem("debug", "nuqs") Dec 13, 2024
@dejoma
Copy link
Author

dejoma commented Dec 13, 2024

The thing that makes it clash/crash/not-work is localStorage.setItem("debug", "nuqs")

If I undo that; it immediately works again. Chrome extension probably is react-dev-tools

@franky47
Copy link
Member

franky47 commented Dec 13, 2024

I can confirm that fmkadmapgofadopljbjfkapdkoienihi is react-developer-tools, but even with a fresh Chrome install and this extension, I cannot reproduce the error.

If you go into node_modules/nuqs/dist/chunk-3RCMAOX7.js and remove the following lines, does it work? (remember to delete your .next folder to avoid using a cached bundled dependency):

function debug(message, ...args) {
  if (!enabled) {
    return;
  }
-  const msg = sprintf(message, ...args);
-  performance.mark(msg);
  console.log(message, ...args);
}

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

2 participants