Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

WhyDidYouRender is not working in Storybook.js #290

Open
syntaxerron opened this issue Jan 26, 2024 · 0 comments
Open

WhyDidYouRender is not working in Storybook.js #290

syntaxerron opened this issue Jan 26, 2024 · 0 comments

Comments

@syntaxerron
Copy link

Issue Summary

WhyDidYouRender is not working as expected in Storybook.js.

Environment Information

  • Storybook Version: 6.4.0
  • React Version: 17.0.2
  • WDYR Version: 7.0.1
  • Node.js Version: 16.13.0
  • Browser: Chrome Version 120.0.6099.227 (Official Build) (64-bit)

Description

I have followed the documentation to integrate WhyDidYouRender (WDYR), but it doesn't seem to be working if I have Storybook.js in my React application. I expected to see logs or indications of re-renders, but nothing is showing up in the console.

Steps to Reproduce

  1. Added the wdyr.js configuration file to the .storybook directory:
    // .storybook/wdyr.js
    import React from 'react';
    
    const whyDidYouRender = require('@welldone-software/why-did-you-render');
    whyDidYouRender(React, {
      trackAllPureComponents: true,
      trackHooks: true,
    });
    
  2. Imported wdyr.js in the preview.js file:
    // .storybook/preview.js
    import './wdyr';
    

Expected Behavior

I expected to see console logs indicating which components re-rendered and why, as specified in the WDYR configuration.

Actual Behavior

No logs or indications of re-renders are showing up in the console.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant