MCPcopy
hub / github.com/react/react / fetchFileWithCaching

Function fetchFileWithCaching

packages/react-devtools-core/src/standalone.js:132–144  ·  view source on GitHub ↗
(url: string)

Source from the content-addressed store, hash-verified

130// Browser extension is doing this via exchanging messages
131// between devtools_page and dedicated content script for it, see `fetchFileWithCaching.js`.
132async function fetchFileWithCaching(url: string) {
133 if (resourceCache.has(url)) {
134 return Promise.resolve(resourceCache.get(url));
135 }
136
137 return fetch(url)
138 .then(data => data.text())
139 .then(content => {
140 resourceCache.set(url, content);
141
142 return content;
143 });
144}
145
146function canViewElementSourceFunction(
147 _source: ReactFunctionLocation | ReactCallSite,

Callers

nothing calls this directly

Calls 5

fetchFunction · 0.85
setMethod · 0.80
hasMethod · 0.65
getMethod · 0.65
thenMethod · 0.65

Tested by

no test coverage detected