Home / Function/ _getHookMapForSource() — react Function Reference

_getHookMapForSource() — react Function Reference

Architecture documentation for the _getHookMapForSource() function in SourceMapMetadataConsumer.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  8363e8e9_bb7f_f116_6160_65e0851ee4a9["_getHookMapForSource()"]
  c91679b7_c93e_6e95_410e_81e24076c30a["SourceMapMetadataConsumer"]
  8363e8e9_bb7f_f116_6160_65e0851ee4a9 -->|defined in| c91679b7_c93e_6e95_410e_81e24076c30a
  53395c34_7472_4850_0d26_5722d5c6d970["hookNameFor()"]
  53395c34_7472_4850_0d26_5722d5c6d970 -->|calls| 8363e8e9_bb7f_f116_6160_65e0851ee4a9
  31b4a475_0699_69a6_a66b_1b98c50a5785["hasHookMap()"]
  31b4a475_0699_69a6_a66b_1b98c50a5785 -->|calls| 8363e8e9_bb7f_f116_6160_65e0851ee4a9
  c02a4f80_a820_866d_445a_6951aae599f7["_getMetadataBySource()"]
  8363e8e9_bb7f_f116_6160_65e0851ee4a9 -->|calls| c02a4f80_a820_866d_445a_6951aae599f7
  320a3b4e_798e_d179_0b68_c45b971d0001["normalizeSourcePath()"]
  8363e8e9_bb7f_f116_6160_65e0851ee4a9 -->|calls| 320a3b4e_798e_d179_0b68_c45b971d0001
  style 8363e8e9_bb7f_f116_6160_65e0851ee4a9 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-devtools-shared/src/hooks/SourceMapMetadataConsumer.js lines 190–206

  _getHookMapForSource(source: string): ?HookMap {
    if (this._decodedHookMapCache.has(source)) {
      return this._decodedHookMapCache.get(source);
    }
    let hookMap = null;
    const metadataBySource = this._getMetadataBySource();
    const normalized = normalizeSourcePath(source, this._sourceMap);
    const metadata = metadataBySource.get(normalized);
    if (metadata != null) {
      const encodedHookMap = metadata[HOOK_MAP_INDEX_IN_REACT_METADATA];
      hookMap = encodedHookMap != null ? decodeHookMap(encodedHookMap) : null;
    }
    if (hookMap != null) {
      this._decodedHookMapCache.set(source, hookMap);
    }
    return hookMap;
  }

Domain

Subdomains

Frequently Asked Questions

What does _getHookMapForSource() do?
_getHookMapForSource() is a function in the react codebase, defined in packages/react-devtools-shared/src/hooks/SourceMapMetadataConsumer.js.
Where is _getHookMapForSource() defined?
_getHookMapForSource() is defined in packages/react-devtools-shared/src/hooks/SourceMapMetadataConsumer.js at line 190.
What does _getHookMapForSource() call?
_getHookMapForSource() calls 2 function(s): _getMetadataBySource, normalizeSourcePath.
What calls _getHookMapForSource()?
_getHookMapForSource() is called by 2 function(s): hasHookMap, hookNameFor.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free