react-scan icon indicating copy to clipboard operation
react-scan copied to clipboard

trackUnnecessaryRenders is reported as unknown option

Open mootari opened this issue 1 year ago • 1 comments

Using react-scan 0.2.8, when calling scan() as follows:

  useEffect(() => {
    scan({
      enabled: process.env.NODE_ENV === "development",
      trackUnnecessaryRenders: true,
    });
  }, []);  

the option is reported as unknown in the console because it is currently commented out in validateOptions: https://github.com/aidenybai/react-scan/blob/164ba1cdde38b7c01dd38700dcb1fa0f8aeef16a/packages/scan/src/core/index.ts#L410-L413

despite being listed in the Options interface: https://github.com/aidenybai/react-scan/blob/164ba1cdde38b7c01dd38700dcb1fa0f8aeef16a/packages/scan/src/core/index.ts#L168-L176

mootari avatar Feb 28 '25 12:02 mootari

This is a mistake and is a deprecated API that was accidentally not fully removed. We may add this back, will have to think a little about it.

What this used to do was make outlines gray when the render didn't affect the DOM- which we consider "unnecessary" (which is not 100% true...). This was really hard to convey meaning and added overhead, so we deemed it wasn't worth keeping.

But, we may find a good opportunity to use it with notifications

RobPruzan avatar Feb 28 '25 19:02 RobPruzan