MCPcopy Index your code
hub / github.com/caseywebdev/react-list / safelyAttachRef

Function safelyAttachRef

docs/index.js:11069–11090  ·  view source on GitHub ↗
(current, nearestMountedAncestor)

Source from the content-addressed store, hash-verified

11067 }
11068}
11069function safelyAttachRef(current, nearestMountedAncestor) {
11070 try {
11071 var ref = current.ref;
11072 if (null !== ref) {
11073 var instance = current.stateNode;
11074 switch (current.tag) {
11075 case 26:
11076 case 27:
11077 case 5:
11078 var instanceToUse = instance;
11079 break;
11080 default:
11081 instanceToUse = instance;
11082 }
11083 "function" === typeof ref
11084 ? (current.refCleanup = ref(instanceToUse))
11085 : (ref.current = instanceToUse);
11086 }
11087 } catch (error) {
11088 captureCommitPhaseError(current, nearestMountedAncestor, error);
11089 }
11090}
11091function safelyDetachRef(current, nearestMountedAncestor) {
11092 var ref = current.ref,
11093 refCleanup = current.refCleanup;

Calls 2

captureCommitPhaseErrorFunction · 0.85
runWithFiberInDEVFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…