Skip to content

Commit 8120753

Browse files
authored
[DevTools] fix: always send a response to fetch-file request in the extension (#34235)
This fixes the displaying of "rendered by" section if owner stacks contained any native frames. This regressed after #34185, where we added the Suspense boundary for the StackTraceView. This fails because the Promise that is responsible for symbolication of the source is never getting resolved or rejected. Previously, we would just throw an Error without sending a corresponding message to the `main` script, and it would just cache a Promise that is never resolved, hence the Suspense boundary for "rendered by" section is never resolved. In a separate change, I think we need to update StackTraceView component to display `native` as location, instead of `:0`: <img width="712" height="118" alt="Screenshot 2025-08-20 at 00 20 42" src="https://github.com/user-attachments/assets/c79735c9-fdd2-467c-96cd-2bc29d38c4e0" />
1 parent 3770ff3 commit 8120753

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

packages/react-devtools-extensions/src/background/messageHandlers.js

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,22 +46,26 @@ export function handleDevToolsPageMessage(message) {
4646
payload: {tabId, url},
4747
} = message;
4848

49-
if (!tabId) {
50-
throw new Error("Couldn't fetch file sources: tabId not specified");
51-
}
52-
53-
if (!url) {
54-
throw new Error("Couldn't fetch file sources: url not specified");
49+
if (!tabId || !url) {
50+
// Send a response straight away to get the Promise fulfilled.
51+
chrome.runtime.sendMessage({
52+
source: 'react-devtools-background',
53+
payload: {
54+
type: 'fetch-file-with-cache-error',
55+
url,
56+
value: null,
57+
},
58+
});
59+
} else {
60+
chrome.tabs.sendMessage(tabId, {
61+
source: 'devtools-page',
62+
payload: {
63+
type: 'fetch-file-with-cache',
64+
url,
65+
},
66+
});
5567
}
5668

57-
chrome.tabs.sendMessage(tabId, {
58-
source: 'devtools-page',
59-
payload: {
60-
type: 'fetch-file-with-cache',
61-
url,
62-
},
63-
});
64-
6569
break;
6670
}
6771

0 commit comments

Comments
 (0)