with the following component:
export default function App({ title }: { title?: string }) {
const [isLoading, setIsLoading] = useState(true);
useEffect(() => {
setIsLoading(false);
}, []);
if (isLoading || !title) {
return <div data-id="line12">Loading...</div>;
}
return (
<div data-id="line-15">
Loaded
<App />
</div>
);
}
when react-dom updates the div (the one with data-id="line12" to the one with data-id="line-15")
it doesn't update _debugSource attribute on the fiber, that's why devtools displays the wrong line number
(see image below)
React version:
18.*
Steps To Reproduce
- clone the github repo below
- start the project and open it in the browser
- open react-devtools
- select the root
div element inside App
The source location is wrong.
Or, you can open the following codesandbox:
codesandbox
open the preview in a separate browser tab, and see the issue in devtools
Link to code example:
github-repo
The current behavior

The expected behavior
source in react devtools should be App.tsx:15
with the following component:
when react-dom updates the div (the one with data-id="line12" to the one with data-id="line-15")
it doesn't update
_debugSourceattribute on the fiber, that's why devtools displays the wrong line number(see image below)
React version:
18.*
Steps To Reproduce
divelement insideAppThe source location is wrong.
Or, you can open the following codesandbox:
codesandbox
open the preview in a separate browser tab, and see the issue in devtools
Link to code example:
github-repo
The current behavior
The expected behavior
source in react devtools should be
App.tsx:15