| 
7 | 7 |  * @flow  | 
8 | 8 |  */  | 
9 | 9 | 
 
  | 
10 |  | -import type {FloatRoot, StyleResource} from './ReactDOMFloatClient';  | 
 | 10 | +import type {  | 
 | 11 | +  FloatRoot,  | 
 | 12 | +  StyleResource,  | 
 | 13 | +  ScriptResource,  | 
 | 14 | +} from './ReactDOMFloatClient';  | 
11 | 15 | import type {Fiber} from 'react-reconciler/src/ReactInternalTypes';  | 
12 | 16 | import type {ReactScopeInstance} from 'shared/ReactTypes';  | 
13 | 17 | import type {  | 
@@ -48,7 +52,7 @@ const internalContainerInstanceKey = '__reactContainer$' + randomKey;  | 
48 | 52 | const internalEventHandlersKey = '__reactEvents$' + randomKey;  | 
49 | 53 | const internalEventHandlerListenersKey = '__reactListeners$' + randomKey;  | 
50 | 54 | const internalEventHandlesSetKey = '__reactHandles$' + randomKey;  | 
51 |  | -const internalRootNodeStylesSetKey = '__reactStyles$' + randomKey;  | 
 | 55 | +const internalRootNodeResourcesKey = '__reactResources$' + randomKey;  | 
52 | 56 | 
 
  | 
53 | 57 | export function detachDeletedInstance(node: Instance): void {  | 
54 | 58 |   // TODO: This function is only called on host components. I don't think all of  | 
@@ -278,10 +282,15 @@ export function doesTargetHaveEventHandle(  | 
278 | 282 |   return eventHandles.has(eventHandle);  | 
279 | 283 | }  | 
280 | 284 | 
 
  | 
281 |  | -export function getStylesFromRoot(root: FloatRoot): Map<string, StyleResource> {  | 
282 |  | -  let styles = (root: any)[internalRootNodeStylesSetKey];  | 
283 |  | -  if (!styles) {  | 
284 |  | -    styles = (root: any)[internalRootNodeStylesSetKey] = new Map();  | 
 | 285 | +export function getResourcesFromRoot(  | 
 | 286 | +  root: FloatRoot,  | 
 | 287 | +): {styles: Map<string, StyleResource>, scripts: Map<string, ScriptResource>} {  | 
 | 288 | +  let resources = (root: any)[internalRootNodeResourcesKey];  | 
 | 289 | +  if (!resources) {  | 
 | 290 | +    resources = (root: any)[internalRootNodeResourcesKey] = {  | 
 | 291 | +      styles: new Map(),  | 
 | 292 | +      scripts: new Map(),  | 
 | 293 | +    };  | 
285 | 294 |   }  | 
286 |  | -  return styles;  | 
 | 295 | +  return resources;  | 
287 | 296 | }  | 
0 commit comments