welldone-software / why-did-you-render

why-did-you-render by Welldone Software monkey patches React to notify you about potentially avoidable re-renders. (Works with React Native as well.)
https://www.npmjs.com/package/@welldone-software/why-did-you-render
MIT License
11.32k stars 199 forks source link

"Support for defaultProps will be removed" error after setting include: [/./] option #286

Closed aktasmehmet closed 5 months ago

aktasmehmet commented 10 months ago

In order to work WDYR with Next 13 and AppRouter without a problem, there is a workround (also mentioned here) to put include: [/./] to whyDidYouRender function.

When I did that, I started to get strange warnings/errors in the browser console which I never got before:

AppRouterAnnouncer: Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead.

Home: Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead.

InnerLayoutRouter: Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead.

...
Screenshot 2024-01-05 at 13 46 13

What might be the reason to this? When I remove include option, the errors are gone.

Xamsix commented 9 months ago

@aktasmehmet I'm experiencing the same issue, did you find a workaround?

aktasmehmet commented 9 months ago

@Xamsix unfortunately not :( Since this not a blocker issue for me, I kept going but yet I am still waiting for a solution to this.

Nilegfx commented 5 months ago

I am facing the same issue. any idea what it is and how can I solve/workaround it?

aktasmehmet commented 5 months ago

Still waiting :(

Hypnosphi commented 5 months ago

I can publish my fork to provide a temporary workaround

Hypnosphi commented 5 months ago

I can publish my fork to provide a temporary workaround

It's available now on npm as @hypnosphi/why-did-you-render. It includes the changes in https://github.com/welldone-software/why-did-you-render/pull/300

Hypnosphi commented 5 months ago

@vzaidman can you please publish 8.0.3 to NPM?

vzaidman commented 5 months ago

@Hypnosphi just did. Sorry for the delay.