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]: incorrect error on react-hooks/exhaustive-deps #32089

Open
sajera opened this issue Jan 16, 2025 · 0 comments
Open

[DevTools Bug]: incorrect error on react-hooks/exhaustive-deps #32089

sajera opened this issue Jan 16, 2025 · 0 comments
Labels
Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug Type: Bug

Comments

@sajera
Copy link

sajera commented Jan 16, 2025

Website or app

http://localhost:3008/

Repro steps

React Hook useMemo has unnecessary dependencies: 'store1.list' and 'store2.list'. Either exclude them or remove the dependency array. Outer scope values like 'domains.content' aren't valid dependencies because mutating them doesn't re-render the component  react-hooks/exhaustive-deps

For an unknown reason, it appears in the following code.

const list = useMemo(() => _.map(store1.list, item => ({
    ...item,
    warnings: _.map(
      _.filter(store2.list, { name: item.name }),
      ({ info }) => ({ label: `Important ${info}` })
    )
  })), [store1.list, store2.list])

And I am sure there is a bug because it doesn't appear in the following code:

const list1 = store1.list
  const list2 = store2.list
  const list = useMemo(() => _.map(list1, item => ({
    ...item,
    warnings: _.map(
      _.filter(list2, { name: item.name }),
      ({ info }) => ({ label: `Important ${info}` })
    )
  })), [list1, list2])

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)


Error component stack (automated)


GitHub query string (automated)


@sajera sajera added Component: Developer Tools Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug Type: Bug labels Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug Type: Bug
Projects
None yet
Development

No branches or pull requests

2 participants