MCPcopy
hub / github.com/facebook/react / safelyAttachRef

Function safelyAttachRef

packages/react-reconciler/src/ReactFiberCommitEffects.js:826–839  ·  view source on GitHub ↗
(
  current: Fiber,
  nearestMountedAncestor: Fiber | null,
)

Source from the content-addressed store, hash-verified

824
825// Capture errors so they don't interrupt mounting.
826export function safelyAttachRef(
827 current: Fiber,
828 nearestMountedAncestor: Fiber | null,
829) {
830 try {
831 if (__DEV__) {
832 runWithFiberInDEV(current, commitAttachRef, current);
833 } else {
834 commitAttachRef(current);
835 }
836 } catch (error) {
837 captureCommitPhaseError(current, nearestMountedAncestor, error);
838 }
839}
840
841export function safelyDetachRef(
842 current: Fiber,

Callers 3

reappearLayoutEffectsFunction · 0.90

Calls 3

runWithFiberInDEVFunction · 0.90
captureCommitPhaseErrorFunction · 0.90
commitAttachRefFunction · 0.85

Tested by

no test coverage detected