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

[DevTools Bug]: Console.log in second call to useMemo callback in strict mode is not dimmed or suppressed #27989

Closed
russelldavis opened this issue Jan 18, 2024 · 2 comments · Fixed by #28249
Labels
Component: Developer Tools Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug Type: Bug

Comments

@russelldavis
Copy link

Website or app

https://codesandbox.io/p/devbox/tender-aryabhata-xtrckf?file=%2Fapp%2Fpage.tsx

Repro steps

This only happens in the canary version of react. Most likely due to the changes made in #25583.

To repro:

  1. Enable strict mode
  2. Call console.log from inside a useMemo callback, e.g.:
  useMemo(() => {
    console.log("useMemo callback")
  }, [])

In React 18.2.0, the log from the second strict mode call to the useMemo callback will be dimmed or suppressed (depending on devtools settings). In React 18.3.0-canary-60a927d04-20240113 (or nextjs 14.0.4), both calls are logged normally.

Note: when using codesandbox to repro, look at the logs from the browser devtools console, not the embedded one in codesandbox, which doesn't always show the same output.

How often does this bug happen?

Every time

DevTools package (automated)

No response

DevTools version (automated)

No response

Error message (automated)

No response

Error call stack (automated)

No response

Error component stack (automated)

No response

GitHub query string (automated)

No response

@russelldavis russelldavis added Component: Developer Tools Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug Type: Bug labels Jan 18, 2024
@Nathan-Roberts123
Copy link

Nathan-Roberts123 commented Jan 27, 2024

I tried to repro the error in vsode with React 18.3.0-canary-60a927d04-20240113, the log from the second strict mode call to the useMemo callback was grey(dimmed). So i found nothing wrong. May it only happends on Nextjs 14.0.4

@russelldavis
Copy link
Author

The bug repros for me on a React 18.3.0-canary-60a927d04-20240113 project without Nextjs.

gsathya added a commit that referenced this issue Feb 6, 2024
This fixes a regression #25583
where we stopped patching before calling useMemo function.

Fixes #27989
github-actions bot pushed a commit that referenced this issue Feb 6, 2024
This fixes a regression #25583
where we stopped patching before calling useMemo function.

Fixes #27989

DiffTrain build for [db120f6](db120f6)
EdisonVan pushed a commit to EdisonVan/react that referenced this issue Apr 15, 2024
…ok#28249)

This fixes a regression facebook#25583
where we stopped patching before calling useMemo function.

Fixes facebook#27989
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Developer Tools Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug Type: Bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants