Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -475,23 +475,25 @@ function loadSourceFiles(

const fetchPromise =
dedupedFetchPromises.get(runtimeSourceURL) ||
fetchFileFunction(runtimeSourceURL).then(runtimeSourceCode => {
// TODO (named hooks) Re-think this; the main case where it matters is when there's no source-maps,
// because then we need to parse the full source file as an AST.
if (runtimeSourceCode.length > MAX_SOURCE_LENGTH) {
throw Error('Source code too large to parse');
}
(runtimeSourceURL && !runtimeSourceURL.startsWith('<anonymous')
? fetchFileFunction(runtimeSourceURL).then(runtimeSourceCode => {
// TODO (named hooks) Re-think this; the main case where it matters is when there's no source-maps,
// because then we need to parse the full source file as an AST.
if (runtimeSourceCode.length > MAX_SOURCE_LENGTH) {
throw Error('Source code too large to parse');
}

if (__DEBUG__) {
console.groupCollapsed(
`loadSourceFiles() runtimeSourceURL "${runtimeSourceURL}"`,
);
console.log(runtimeSourceCode);
console.groupEnd();
}
if (__DEBUG__) {
console.groupCollapsed(
`loadSourceFiles() runtimeSourceURL "${runtimeSourceURL}"`,
);
console.log(runtimeSourceCode);
console.groupEnd();
}

return runtimeSourceCode;
});
return runtimeSourceCode;
})
: Promise.reject(new Error('Empty url')));
dedupedFetchPromises.set(runtimeSourceURL, fetchPromise);

setterPromises.push(
Expand Down
3 changes: 3 additions & 0 deletions packages/react-devtools-shared/src/symbolicateSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ export async function symbolicateSource(
lineNumber: number, // 1-based
columnNumber: number, // 1-based
): Promise<SourceMappedLocation | null> {
if (!sourceURL || sourceURL.startsWith('<anonymous')) {
return null;
}
const resource = await fetchFileWithCaching(sourceURL).catch(() => null);
if (resource == null) {
return null;
Expand Down
Loading