Command Palette

Search for a command to run...

Bounties

Learn more about bounties here →

Amount Paid Out
0
Amount Open
0.000138
Repos with Bounties
1
Total Bounties
3
2 Bounties
Sort:
fa
facebook/react#35276

Bug: react-hooks/set-state-in-effect: false-positive with ternary

React version: react@19.2.0, eslint-plugin-react-hooks@7.0.1 ## Steps To Reproduce ```tsx function getWidth(el: HTMLElement) { return el.clientWidth; } function Component({value}: {value: string}) { const [width, setWidth] = useState(0); const ref = useRef<HTMLDivElement>(null); useEffect(() => { setWidth(ref.current ? getWidth(ref.current) : 0); // ^^^^^^^^^^^^ Avoid calling setState() directly within an effect }, [value]); return <div ref={ref}>{value}{width}</div>; } ``` Changing the line to `setWidth(getWidth(ref.current));` makes the error go away, so it seems the presence of the ternary operator is confusing the rule. ## The current behavior Error is raised. ## The expected behavior No error to be raised.

$0.000088OPEN
fa
facebook/react#26465

[DevTools Bug] Cannot add child "1161" to parent "942" because parent node was not found in the Store.

### Website or app chrome on local host ### Repro steps it happen with every component that i mount <img width="1470" alt="Screenshot 2023-03-23 at 1 04 00 PM" src="https://user-images.githubusercontent.com/110327079/227134701-d665feca-3326-401e-b957-007c41318be6.png"> ### How often does this bug happen? Every time ### DevTools package (automated) react-devtools-extensions ### DevTools version (automated) 4.27.2-1a88fbb67 ### Error message (automated) Cannot add child "1161" to parent "942" because parent node was not found in the Store. ### Error call stack (automated) ```text at chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:27939:43 at bridge_Bridge.emit (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:25892:22) at chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:26061:14 at listener (chrome-extension://fmkadmapgofadopljbjfkapdkoienihi/build/main.js:56323:39) ``` ### Error component stack (automated) _No response_ ### GitHub query string (automated) ```text https://api.github.com/search/issues?q=Cannot add child to parent because parent node was not found in the Store. in:title is:issue is:open is:public label:"Component: Developer Tools" repo:facebook/react ```

$0.00005OPEN