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] 0.0 ms render duration #532

Open
siddharthkul opened this issue Oct 11, 2024 · 1 comment
Open

[BUG] 0.0 ms render duration #532

siddharthkul opened this issue Oct 11, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@siddharthkul
Copy link

siddharthkul commented Oct 11, 2024

Describe the bug
👋 Hey team, I am experimenting with integrating reassure into my monorepo. We maintain 2 packages: web and mobile.

For mobile (react-native) we are seeing an issue where all benchmarks show 0.0 ms render duration for all tests. When I affect render counts, we are able to see changes show up in the mobile benchmarks.

This is not the case for web (react) package which shows correct render and duration info.

Screenshot 2024-10-11 at 2 14 44 PM
@siddharthkul siddharthkul added the bug Something isn't working label Oct 11, 2024
@mdjastrzebski
Copy link
Member

@siddharthkul thanks for reporting this. As far as I can tell from the source code, it seem that the onRender callback from React.Profiler got called exactly one per each component (you have render count == 1). This is the first issue of such type, so I can guess that one of the following have happened:

  1. You are testing really small components and a relatively fast machine and they really render under 0.5ms, which gets rounded to 0.
  2. You have some mocking that effectively makes the components really cheap to render (see pt. 1)
  3. You are using Jest fake timers which might interfere with React.Profiler component

What you could do is to add artificial code to your component(s) with the purpose of slowing them down to detect if Reassure can pick it up. Something like:

function MyButton() {
  // Dummy code to make sure component has non-zero render time
  for (let i = 0; i < 10_000; i += 1) {
     console.log("AAA");
  }

  return <JSX... />
}

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