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

[Bug]: defaultProps Warnings #27027

Closed
morganney opened this issue May 5, 2024 · 7 comments · Fixed by #26960
Closed

[Bug]: defaultProps Warnings #27027

morganney opened this issue May 5, 2024 · 7 comments · Fixed by #26960

Comments

@morganney
Copy link

Describe the bug

Not strictly a bug, but React versions >= 18.3.0 report console warnings of unsupported features in React 19.

react-dom.development.js:86 Warning: WithTooltipPure: Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead.

In my particular case it was from the tooltip component used by the docs addon:

Any particular plans to remove these warnings in version 8 of storybook, or are you going to push a new major version that supports React 19?

To Reproduce

Use @storybook/react with @storybook/addon-docs.

System

morgan@machine:~/code/tts-react (develop)$ ./node_modules/.bin/storybook info

Storybook Environment Info:
(node:18511) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)

  System:
    OS: Linux 6.8 Ubuntu 22.04.4 LTS 22.04.4 LTS (Jammy Jellyfish)
    CPU: (12) x64 13th Gen Intel(R) Core(TM) i5-1335U
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 22.1.0 - ~/n/bin/node
    npm: 10.7.0 - ~/n/bin/npm <----- active
  Browsers:
    Chrome: 124.0.6367.118

Additional context

No response

@morganney
Copy link
Author

morganney commented May 5, 2024

Looks like you should also update your node-fetch version used in @storybook/core-common to load the transitive dep whatwg-url >= 9.0.0 and avoid the punycode deprecation warning.

morgan@machine:~/code/tts-react (develop)$ node --trace-deprecation ./node_modules/.bin/storybook info

Storybook Environment Info:
(node:50775) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
    at node:punycode:3:9
    at BuiltinModule.compileForInternalLoader (node:internal/bootstrap/realm:398:7)
    at BuiltinModule.compileForPublicLoader (node:internal/bootstrap/realm:337:10)
    at loadBuiltinModule (node:internal/modules/helpers:104:7)
    at Module._load (node:internal/modules/cjs/loader:1075:17)
    at Module.require (node:internal/modules/cjs/loader:1310:19)
    at require (node:internal/modules/helpers:179:18)
    at Object.<anonymous> (/home/morgan/code/tts-react/node_modules/node-fetch/node_modules/whatwg-url/lib/url-state-machine.js:2:18)
    at Module._compile (node:internal/modules/cjs/loader:1480:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1564:10)

  System:
    OS: Linux 6.8 Ubuntu 22.04.4 LTS 22.04.4 LTS (Jammy Jellyfish)
    CPU: (12) x64 13th Gen Intel(R) Core(TM) i5-1335U
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 22.1.0 - ~/n/bin/node
    npm: 10.7.0 - ~/n/bin/npm <----- active
  Browsers:
    Chrome: 124.0.6367.118

morgan@machine:~/code/tts-react (develop)$ npm ls node-fetch
tts-react-monorepo@0.0.0 /home/morgan/code/tts-react
└─┬ story@1.0.0 -> ./packages/story
  └─┬ @storybook/react-webpack5@8.0.10
    └─┬ @storybook/builder-webpack5@8.0.10
      └─┬ @storybook/core-common@8.0.10
        └── node-fetch@2.7.0

morgan@machine:~/code/tts-react (develop)$ npm ls whatwg-url
tts-react-monorepo@0.0.0 /home/morgan/code/tts-react
├─┬ jest-environment-jsdom@29.5.0
│ └─┬ jsdom@20.0.3
│   ├─┬ data-urls@3.0.2
│   │ └── whatwg-url@11.0.0 deduped
│   └── whatwg-url@11.0.0
└─┬ story@1.0.0 -> ./packages/story
  └─┬ @storybook/react-webpack5@8.0.10
    └─┬ @storybook/builder-webpack5@8.0.10
      └─┬ @storybook/core-common@8.0.10
        └─┬ node-fetch@2.7.0
          └── whatwg-url@5.0.0

@RBilly
Copy link

RBilly commented May 14, 2024

I would like to add that an effort has been made to remove usage of defaultProps in some blocks like Stories and Link (see #24305).
But I still have the issue with the Source, Tabs and WithTooltipPure components and there may be others.

@valentinpalkovic
Copy link
Contributor

Fixed by #26960

@morganney
Copy link
Author

morganney commented May 14, 2024

@valentinpalkovic I think there will still be the issue I mentioned with the deprecation warning about punycode.

Looks like the next branch still contains an older version of whatwg-url.

Should I open another ticket for that?

@filipbatur
Copy link

Fixed by #26960

In what release is it gonna be included?

@valentinpalkovic
Copy link
Contributor

@valentinpalkovic I think there will still be the issue I mentioned with the deprecation warning about punycode.

Looks like the next branch still contains an older version of whatwg-url.

Should I open another ticket for that?

No, I take care of it.

@valentinpalkovic
Copy link
Contributor

Fixed by #26960

In what release is it gonna be included?

It should be included in v8.1, which was released yesterday.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants