code
stringlengths 24
2.07M
| docstring
stringlengths 25
85.3k
| func_name
stringlengths 1
92
| language
stringclasses 1
value | repo
stringlengths 5
64
| path
stringlengths 4
172
| url
stringlengths 44
218
| license
stringclasses 7
values |
---|---|---|---|---|---|---|---|
function validateProperty(tagName, name) {
{
if (hasOwnProperty.call(warnedProperties, name) && warnedProperties[name]) {
return true;
}
if (rARIACamel.test(name)) {
var ariaName = 'aria-' + name.slice(4).toLowerCase();
var correctName = ariaProperties.hasOwnProperty(ariaName) ? ariaName : null; // If this is an aria-* attribute, but is not listed in the known DOM
// DOM properties, then it is an invalid aria-* attribute.
if (correctName == null) {
error('Invalid ARIA attribute `%s`. ARIA attributes follow the pattern aria-* and must be lowercase.', name);
warnedProperties[name] = true;
return true;
} // aria-* attributes should be lowercase; suggest the lowercase version.
if (name !== correctName) {
error('Invalid ARIA attribute `%s`. Did you mean `%s`?', name, correctName);
warnedProperties[name] = true;
return true;
}
}
if (rARIA.test(name)) {
var lowerCasedName = name.toLowerCase();
var standardName = ariaProperties.hasOwnProperty(lowerCasedName) ? lowerCasedName : null; // If this is an aria-* attribute, but is not listed in the known DOM
// DOM properties, then it is an invalid aria-* attribute.
if (standardName == null) {
warnedProperties[name] = true;
return false;
} // aria-* attributes should be lowercase; suggest the lowercase version.
if (name !== standardName) {
error('Unknown ARIA attribute `%s`. Did you mean `%s`?', name, standardName);
warnedProperties[name] = true;
return true;
}
}
}
return true;
}
|
When mixing shorthand and longhand property names, we warn during updates if
we expect an incorrect result to occur. In particular, we warn for:
Updating a shorthand property (longhand gets overwritten):
{font: 'foo', fontVariant: 'bar'} -> {font: 'baz', fontVariant: 'bar'}
becomes .style.font = 'baz'
Removing a shorthand property (longhand gets lost too):
{font: 'foo', fontVariant: 'bar'} -> {fontVariant: 'bar'}
becomes .style.font = ''
Removing a longhand property (should revert to shorthand; doesn't):
{font: 'foo', fontVariant: 'bar'} -> {font: 'foo'}
becomes .style.fontVariant = ''
|
validateProperty
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function warnInvalidARIAProps(type, props) {
{
var invalidProps = [];
for (var key in props) {
var isValid = validateProperty(type, key);
if (!isValid) {
invalidProps.push(key);
}
}
var unknownPropString = invalidProps.map(function (prop) {
return '`' + prop + '`';
}).join(', ');
if (invalidProps.length === 1) {
error('Invalid aria prop %s on <%s> tag. ' + 'For details, see https://reactjs.org/link/invalid-aria-props', unknownPropString, type);
} else if (invalidProps.length > 1) {
error('Invalid aria props %s on <%s> tag. ' + 'For details, see https://reactjs.org/link/invalid-aria-props', unknownPropString, type);
}
}
}
|
When mixing shorthand and longhand property names, we warn during updates if
we expect an incorrect result to occur. In particular, we warn for:
Updating a shorthand property (longhand gets overwritten):
{font: 'foo', fontVariant: 'bar'} -> {font: 'baz', fontVariant: 'bar'}
becomes .style.font = 'baz'
Removing a shorthand property (longhand gets lost too):
{font: 'foo', fontVariant: 'bar'} -> {fontVariant: 'bar'}
becomes .style.font = ''
Removing a longhand property (should revert to shorthand; doesn't):
{font: 'foo', fontVariant: 'bar'} -> {font: 'foo'}
becomes .style.fontVariant = ''
|
warnInvalidARIAProps
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function validateProperties(type, props) {
if (isCustomComponent(type, props)) {
return;
}
warnInvalidARIAProps(type, props);
}
|
When mixing shorthand and longhand property names, we warn during updates if
we expect an incorrect result to occur. In particular, we warn for:
Updating a shorthand property (longhand gets overwritten):
{font: 'foo', fontVariant: 'bar'} -> {font: 'baz', fontVariant: 'bar'}
becomes .style.font = 'baz'
Removing a shorthand property (longhand gets lost too):
{font: 'foo', fontVariant: 'bar'} -> {fontVariant: 'bar'}
becomes .style.font = ''
Removing a longhand property (should revert to shorthand; doesn't):
{font: 'foo', fontVariant: 'bar'} -> {font: 'foo'}
becomes .style.fontVariant = ''
|
validateProperties
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function validateProperties$1(type, props) {
{
if (type !== 'input' && type !== 'textarea' && type !== 'select') {
return;
}
if (props != null && props.value === null && !didWarnValueNull) {
didWarnValueNull = true;
if (type === 'select' && props.multiple) {
error('`value` prop on `%s` should not be null. ' + 'Consider using an empty array when `multiple` is set to `true` ' + 'to clear the component or `undefined` for uncontrolled components.', type);
} else {
error('`value` prop on `%s` should not be null. ' + 'Consider using an empty string to clear the component or `undefined` ' + 'for uncontrolled components.', type);
}
}
}
}
|
When mixing shorthand and longhand property names, we warn during updates if
we expect an incorrect result to occur. In particular, we warn for:
Updating a shorthand property (longhand gets overwritten):
{font: 'foo', fontVariant: 'bar'} -> {font: 'baz', fontVariant: 'bar'}
becomes .style.font = 'baz'
Removing a shorthand property (longhand gets lost too):
{font: 'foo', fontVariant: 'bar'} -> {fontVariant: 'bar'}
becomes .style.font = ''
Removing a longhand property (should revert to shorthand; doesn't):
{font: 'foo', fontVariant: 'bar'} -> {font: 'foo'}
becomes .style.fontVariant = ''
|
validateProperties$1
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
warnUnknownProperties = function (type, props, eventRegistry) {
{
var unknownProps = [];
for (var key in props) {
var isValid = validateProperty$1(type, key, props[key], eventRegistry);
if (!isValid) {
unknownProps.push(key);
}
}
var unknownPropString = unknownProps.map(function (prop) {
return '`' + prop + '`';
}).join(', ');
if (unknownProps.length === 1) {
error('Invalid value for prop %s on <%s> tag. Either remove it from the element, ' + 'or pass a string or number value to keep it in the DOM. ' + 'For details, see https://reactjs.org/link/attribute-behavior ', unknownPropString, type);
} else if (unknownProps.length > 1) {
error('Invalid values for props %s on <%s> tag. Either remove them from the element, ' + 'or pass a string or number value to keep them in the DOM. ' + 'For details, see https://reactjs.org/link/attribute-behavior ', unknownPropString, type);
}
}
}
|
When mixing shorthand and longhand property names, we warn during updates if
we expect an incorrect result to occur. In particular, we warn for:
Updating a shorthand property (longhand gets overwritten):
{font: 'foo', fontVariant: 'bar'} -> {font: 'baz', fontVariant: 'bar'}
becomes .style.font = 'baz'
Removing a shorthand property (longhand gets lost too):
{font: 'foo', fontVariant: 'bar'} -> {fontVariant: 'bar'}
becomes .style.font = ''
Removing a longhand property (should revert to shorthand; doesn't):
{font: 'foo', fontVariant: 'bar'} -> {font: 'foo'}
becomes .style.fontVariant = ''
|
warnUnknownProperties
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function validateProperties$2(type, props, eventRegistry) {
if (isCustomComponent(type, props)) {
return;
}
warnUnknownProperties(type, props, eventRegistry);
}
|
When mixing shorthand and longhand property names, we warn during updates if
we expect an incorrect result to occur. In particular, we warn for:
Updating a shorthand property (longhand gets overwritten):
{font: 'foo', fontVariant: 'bar'} -> {font: 'baz', fontVariant: 'bar'}
becomes .style.font = 'baz'
Removing a shorthand property (longhand gets lost too):
{font: 'foo', fontVariant: 'bar'} -> {fontVariant: 'bar'}
becomes .style.font = ''
Removing a longhand property (should revert to shorthand; doesn't):
{font: 'foo', fontVariant: 'bar'} -> {font: 'foo'}
becomes .style.fontVariant = ''
|
validateProperties$2
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function setReplayingEvent(event) {
{
if (currentReplayingEvent !== null) {
error('Expected currently replaying event to be null. This error ' + 'is likely caused by a bug in React. Please file an issue.');
}
}
currentReplayingEvent = event;
}
|
When mixing shorthand and longhand property names, we warn during updates if
we expect an incorrect result to occur. In particular, we warn for:
Updating a shorthand property (longhand gets overwritten):
{font: 'foo', fontVariant: 'bar'} -> {font: 'baz', fontVariant: 'bar'}
becomes .style.font = 'baz'
Removing a shorthand property (longhand gets lost too):
{font: 'foo', fontVariant: 'bar'} -> {fontVariant: 'bar'}
becomes .style.font = ''
Removing a longhand property (should revert to shorthand; doesn't):
{font: 'foo', fontVariant: 'bar'} -> {font: 'foo'}
becomes .style.fontVariant = ''
|
setReplayingEvent
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function resetReplayingEvent() {
{
if (currentReplayingEvent === null) {
error('Expected currently replaying event to not be null. This error ' + 'is likely caused by a bug in React. Please file an issue.');
}
}
currentReplayingEvent = null;
}
|
When mixing shorthand and longhand property names, we warn during updates if
we expect an incorrect result to occur. In particular, we warn for:
Updating a shorthand property (longhand gets overwritten):
{font: 'foo', fontVariant: 'bar'} -> {font: 'baz', fontVariant: 'bar'}
becomes .style.font = 'baz'
Removing a shorthand property (longhand gets lost too):
{font: 'foo', fontVariant: 'bar'} -> {fontVariant: 'bar'}
becomes .style.font = ''
Removing a longhand property (should revert to shorthand; doesn't):
{font: 'foo', fontVariant: 'bar'} -> {font: 'foo'}
becomes .style.fontVariant = ''
|
resetReplayingEvent
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function isReplayingEvent(event) {
return event === currentReplayingEvent;
}
|
When mixing shorthand and longhand property names, we warn during updates if
we expect an incorrect result to occur. In particular, we warn for:
Updating a shorthand property (longhand gets overwritten):
{font: 'foo', fontVariant: 'bar'} -> {font: 'baz', fontVariant: 'bar'}
becomes .style.font = 'baz'
Removing a shorthand property (longhand gets lost too):
{font: 'foo', fontVariant: 'bar'} -> {fontVariant: 'bar'}
becomes .style.font = ''
Removing a longhand property (should revert to shorthand; doesn't):
{font: 'foo', fontVariant: 'bar'} -> {font: 'foo'}
becomes .style.fontVariant = ''
|
isReplayingEvent
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function getEventTarget(nativeEvent) {
// Fallback to nativeEvent.srcElement for IE9
// https://github.com/facebook/react/issues/12506
var target = nativeEvent.target || nativeEvent.srcElement || window; // Normalize SVG <use> element events #4963
if (target.correspondingUseElement) {
target = target.correspondingUseElement;
} // Safari may fire events on text nodes (Node.TEXT_NODE is 3).
// @see http://www.quirksmode.org/js/events_properties.html
return target.nodeType === TEXT_NODE ? target.parentNode : target;
}
|
Gets the target node from a native browser event by accounting for
inconsistencies in browser DOM APIs.
@param {object} nativeEvent Native browser event.
@return {DOMEventTarget} Target node.
|
getEventTarget
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function restoreStateOfTarget(target) {
// We perform this translation at the end of the event loop so that we
// always receive the correct fiber here
var internalInstance = getInstanceFromNode(target);
if (!internalInstance) {
// Unmounted
return;
}
if (typeof restoreImpl !== 'function') {
throw new Error('setRestoreImplementation() needs to be called to handle a target for controlled ' + 'events. This error is likely caused by a bug in React. Please file an issue.');
}
var stateNode = internalInstance.stateNode; // Guard against Fiber being unmounted.
if (stateNode) {
var _props = getFiberCurrentPropsFromNode(stateNode);
restoreImpl(internalInstance.stateNode, internalInstance.type, _props);
}
}
|
Gets the target node from a native browser event by accounting for
inconsistencies in browser DOM APIs.
@param {object} nativeEvent Native browser event.
@return {DOMEventTarget} Target node.
|
restoreStateOfTarget
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function setRestoreImplementation(impl) {
restoreImpl = impl;
}
|
Gets the target node from a native browser event by accounting for
inconsistencies in browser DOM APIs.
@param {object} nativeEvent Native browser event.
@return {DOMEventTarget} Target node.
|
setRestoreImplementation
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function enqueueStateRestore(target) {
if (restoreTarget) {
if (restoreQueue) {
restoreQueue.push(target);
} else {
restoreQueue = [target];
}
} else {
restoreTarget = target;
}
}
|
Gets the target node from a native browser event by accounting for
inconsistencies in browser DOM APIs.
@param {object} nativeEvent Native browser event.
@return {DOMEventTarget} Target node.
|
enqueueStateRestore
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function needsStateRestore() {
return restoreTarget !== null || restoreQueue !== null;
}
|
Gets the target node from a native browser event by accounting for
inconsistencies in browser DOM APIs.
@param {object} nativeEvent Native browser event.
@return {DOMEventTarget} Target node.
|
needsStateRestore
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function restoreStateIfNeeded() {
if (!restoreTarget) {
return;
}
var target = restoreTarget;
var queuedTargets = restoreQueue;
restoreTarget = null;
restoreQueue = null;
restoreStateOfTarget(target);
if (queuedTargets) {
for (var i = 0; i < queuedTargets.length; i++) {
restoreStateOfTarget(queuedTargets[i]);
}
}
}
|
Gets the target node from a native browser event by accounting for
inconsistencies in browser DOM APIs.
@param {object} nativeEvent Native browser event.
@return {DOMEventTarget} Target node.
|
restoreStateIfNeeded
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
batchedUpdatesImpl = function (fn, bookkeeping) {
return fn(bookkeeping);
}
|
Gets the target node from a native browser event by accounting for
inconsistencies in browser DOM APIs.
@param {object} nativeEvent Native browser event.
@return {DOMEventTarget} Target node.
|
batchedUpdatesImpl
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function finishEventHandler() {
// Here we wait until all updates have propagated, which is important
// when using controlled components within layers:
// https://github.com/facebook/react/issues/1698
// Then we restore state of any controlled component.
var controlledComponentsHavePendingUpdates = needsStateRestore();
if (controlledComponentsHavePendingUpdates) {
// If a controlled event was fired, we may need to restore the state of
// the DOM node back to the controlled value. This is necessary when React
// bails out of the update without touching the DOM.
// TODO: Restore state in the microtask, after the discrete updates flush,
// instead of early flushing them here.
flushSyncImpl();
restoreStateIfNeeded();
}
}
|
Gets the target node from a native browser event by accounting for
inconsistencies in browser DOM APIs.
@param {object} nativeEvent Native browser event.
@return {DOMEventTarget} Target node.
|
finishEventHandler
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function batchedUpdates(fn, a, b) {
if (isInsideEventHandler) {
// If we are currently inside another batch, we need to wait until it
// fully completes before restoring state.
return fn(a, b);
}
isInsideEventHandler = true;
try {
return batchedUpdatesImpl(fn, a, b);
} finally {
isInsideEventHandler = false;
finishEventHandler();
}
} // TODO: Replace with flushSync
|
Gets the target node from a native browser event by accounting for
inconsistencies in browser DOM APIs.
@param {object} nativeEvent Native browser event.
@return {DOMEventTarget} Target node.
|
batchedUpdates
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function setBatchingImplementation(_batchedUpdatesImpl, _discreteUpdatesImpl, _flushSyncImpl) {
batchedUpdatesImpl = _batchedUpdatesImpl;
flushSyncImpl = _flushSyncImpl;
}
|
Gets the target node from a native browser event by accounting for
inconsistencies in browser DOM APIs.
@param {object} nativeEvent Native browser event.
@return {DOMEventTarget} Target node.
|
setBatchingImplementation
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function isInteractive(tag) {
return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea';
}
|
Gets the target node from a native browser event by accounting for
inconsistencies in browser DOM APIs.
@param {object} nativeEvent Native browser event.
@return {DOMEventTarget} Target node.
|
isInteractive
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function shouldPreventMouseEvent(name, type, props) {
switch (name) {
case 'onClick':
case 'onClickCapture':
case 'onDoubleClick':
case 'onDoubleClickCapture':
case 'onMouseDown':
case 'onMouseDownCapture':
case 'onMouseMove':
case 'onMouseMoveCapture':
case 'onMouseUp':
case 'onMouseUpCapture':
case 'onMouseEnter':
return !!(props.disabled && isInteractive(type));
default:
return false;
}
}
|
Gets the target node from a native browser event by accounting for
inconsistencies in browser DOM APIs.
@param {object} nativeEvent Native browser event.
@return {DOMEventTarget} Target node.
|
shouldPreventMouseEvent
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function getListener(inst, registrationName) {
var stateNode = inst.stateNode;
if (stateNode === null) {
// Work in progress (ex: onload events in incremental mode).
return null;
}
var props = getFiberCurrentPropsFromNode(stateNode);
if (props === null) {
// Work in progress.
return null;
}
var listener = props[registrationName];
if (shouldPreventMouseEvent(registrationName, inst.type, props)) {
return null;
}
if (listener && typeof listener !== 'function') {
throw new Error("Expected `" + registrationName + "` listener to be a function, instead got a value of `" + typeof listener + "` type.");
}
return listener;
}
|
@param {object} inst The instance, which is the source of events.
@param {string} registrationName Name of listener (e.g. `onClick`).
@return {?function} The stored callback.
|
getListener
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function invokeGuardedCallbackProd(name, func, context, a, b, c, d, e, f) {
var funcArgs = Array.prototype.slice.call(arguments, 3);
try {
func.apply(context, funcArgs);
} catch (error) {
this.onError(error);
}
}
|
@param {object} inst The instance, which is the source of events.
@param {string} registrationName Name of listener (e.g. `onClick`).
@return {?function} The stored callback.
|
invokeGuardedCallbackProd
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function restoreAfterDispatch() {
// We immediately remove the callback from event listeners so that
// nested `invokeGuardedCallback` calls do not clash. Otherwise, a
// nested call would trigger the fake event handlers of any call higher
// in the stack.
fakeNode.removeEventListener(evtType, callCallback, false); // We check for window.hasOwnProperty('event') to prevent the
// window.event assignment in both IE <= 10 as they throw an error
// "Member not found" in strict mode, and in Firefox which does not
// support window.event.
if (typeof window.event !== 'undefined' && window.hasOwnProperty('event')) {
window.event = windowEvent;
}
} // Create an event handler for our fake event. We will synchronously
|
@param {object} inst The instance, which is the source of events.
@param {string} registrationName Name of listener (e.g. `onClick`).
@return {?function} The stored callback.
|
restoreAfterDispatch
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function callCallback() {
didCall = true;
restoreAfterDispatch();
func.apply(context, funcArgs);
didError = false;
} // Create a global error event handler. We use this to capture the value
|
@param {object} inst The instance, which is the source of events.
@param {string} registrationName Name of listener (e.g. `onClick`).
@return {?function} The stored callback.
|
callCallback
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function handleWindowError(event) {
error = event.error;
didSetError = true;
if (error === null && event.colno === 0 && event.lineno === 0) {
isCrossOriginError = true;
}
if (event.defaultPrevented) {
// Some other error handler has prevented default.
// Browsers silence the error report if this happens.
// We'll remember this to later decide whether to log it or not.
if (error != null && typeof error === 'object') {
try {
error._suppressLogging = true;
} catch (inner) {// Ignore.
}
}
}
} // Create a fake event type.
|
@param {object} inst The instance, which is the source of events.
@param {string} registrationName Name of listener (e.g. `onClick`).
@return {?function} The stored callback.
|
handleWindowError
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function invokeGuardedCallback(name, func, context, a, b, c, d, e, f) {
hasError = false;
caughtError = null;
invokeGuardedCallbackImpl$1.apply(reporter, arguments);
}
|
Call a function while guarding against errors that happens within it.
Returns an error if it throws, otherwise null.
In production, this is implemented using a try-catch. The reason we don't
use a try-catch directly is so that we can swap out a different
implementation in DEV mode.
@param {String} name of the guard to use for logging or debugging
@param {Function} func The function to invoke
@param {*} context The context to use when calling the function
@param {...*} args Arguments for function
|
invokeGuardedCallback
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function invokeGuardedCallbackAndCatchFirstError(name, func, context, a, b, c, d, e, f) {
invokeGuardedCallback.apply(this, arguments);
if (hasError) {
var error = clearCaughtError();
if (!hasRethrowError) {
hasRethrowError = true;
rethrowError = error;
}
}
}
|
Same as invokeGuardedCallback, but instead of returning an error, it stores
it in a global so it can be rethrown by `rethrowCaughtError` later.
TODO: See if caughtError and rethrowError can be unified.
@param {String} name of the guard to use for logging or debugging
@param {Function} func The function to invoke
@param {*} context The context to use when calling the function
@param {...*} args Arguments for function
|
invokeGuardedCallbackAndCatchFirstError
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function rethrowCaughtError() {
if (hasRethrowError) {
var error = rethrowError;
hasRethrowError = false;
rethrowError = null;
throw error;
}
}
|
During execution of guarded functions we will capture the first error which
we will rethrow to be handled by the top level error handler.
|
rethrowCaughtError
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function hasCaughtError() {
return hasError;
}
|
During execution of guarded functions we will capture the first error which
we will rethrow to be handled by the top level error handler.
|
hasCaughtError
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function clearCaughtError() {
if (hasError) {
var error = caughtError;
hasError = false;
caughtError = null;
return error;
} else {
throw new Error('clearCaughtError was called but no error was captured. This error ' + 'is likely caused by a bug in React. Please file an issue.');
}
}
|
During execution of guarded functions we will capture the first error which
we will rethrow to be handled by the top level error handler.
|
clearCaughtError
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function get(key) {
return key._reactInternals;
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
get
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function has(key) {
return key._reactInternals !== undefined;
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
has
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function set(key, value) {
key._reactInternals = value;
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
set
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function getNearestMountedFiber(fiber) {
var node = fiber;
var nearestMounted = fiber;
if (!fiber.alternate) {
// If there is no alternate, this might be a new tree that isn't inserted
// yet. If it is, then it will have a pending insertion effect on it.
var nextNode = node;
do {
node = nextNode;
if ((node.flags & (Placement | Hydrating)) !== NoFlags) {
// This is an insertion or in-progress hydration. The nearest possible
// mounted fiber is the parent but we need to continue to figure out
// if that one is still mounted.
nearestMounted = node.return;
}
nextNode = node.return;
} while (nextNode);
} else {
while (node.return) {
node = node.return;
}
}
if (node.tag === HostRoot) {
// TODO: Check if this was a nested HostRoot when used with
// renderContainerIntoSubtree.
return nearestMounted;
} // If we didn't hit the root, that means that we're in an disconnected tree
// that has been unmounted.
return null;
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
getNearestMountedFiber
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function getSuspenseInstanceFromFiber(fiber) {
if (fiber.tag === SuspenseComponent) {
var suspenseState = fiber.memoizedState;
if (suspenseState === null) {
var current = fiber.alternate;
if (current !== null) {
suspenseState = current.memoizedState;
}
}
if (suspenseState !== null) {
return suspenseState.dehydrated;
}
}
return null;
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
getSuspenseInstanceFromFiber
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function getContainerFromFiber(fiber) {
return fiber.tag === HostRoot ? fiber.stateNode.containerInfo : null;
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
getContainerFromFiber
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function isFiberMounted(fiber) {
return getNearestMountedFiber(fiber) === fiber;
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
isFiberMounted
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function isMounted(component) {
{
var owner = ReactCurrentOwner.current;
if (owner !== null && owner.tag === ClassComponent) {
var ownerFiber = owner;
var instance = ownerFiber.stateNode;
if (!instance._warnedAboutRefsInRender) {
error('%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', getComponentNameFromFiber(ownerFiber) || 'A component');
}
instance._warnedAboutRefsInRender = true;
}
}
var fiber = get(component);
if (!fiber) {
return false;
}
return getNearestMountedFiber(fiber) === fiber;
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
isMounted
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function assertIsMounted(fiber) {
if (getNearestMountedFiber(fiber) !== fiber) {
throw new Error('Unable to find node on an unmounted component.');
}
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
assertIsMounted
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function findCurrentFiberUsingSlowPath(fiber) {
var alternate = fiber.alternate;
if (!alternate) {
// If there is no alternate, then we only need to check if it is mounted.
var nearestMounted = getNearestMountedFiber(fiber);
if (nearestMounted === null) {
throw new Error('Unable to find node on an unmounted component.');
}
if (nearestMounted !== fiber) {
return null;
}
return fiber;
} // If we have two possible branches, we'll walk backwards up to the root
// to see what path the root points to. On the way we may hit one of the
// special cases and we'll deal with them.
var a = fiber;
var b = alternate;
while (true) {
var parentA = a.return;
if (parentA === null) {
// We're at the root.
break;
}
var parentB = parentA.alternate;
if (parentB === null) {
// There is no alternate. This is an unusual case. Currently, it only
// happens when a Suspense component is hidden. An extra fragment fiber
// is inserted in between the Suspense fiber and its children. Skip
// over this extra fragment fiber and proceed to the next parent.
var nextParent = parentA.return;
if (nextParent !== null) {
a = b = nextParent;
continue;
} // If there's no parent, we're at the root.
break;
} // If both copies of the parent fiber point to the same child, we can
// assume that the child is current. This happens when we bailout on low
// priority: the bailed out fiber's child reuses the current child.
if (parentA.child === parentB.child) {
var child = parentA.child;
while (child) {
if (child === a) {
// We've determined that A is the current branch.
assertIsMounted(parentA);
return fiber;
}
if (child === b) {
// We've determined that B is the current branch.
assertIsMounted(parentA);
return alternate;
}
child = child.sibling;
} // We should never have an alternate for any mounting node. So the only
// way this could possibly happen is if this was unmounted, if at all.
throw new Error('Unable to find node on an unmounted component.');
}
if (a.return !== b.return) {
// The return pointer of A and the return pointer of B point to different
// fibers. We assume that return pointers never criss-cross, so A must
// belong to the child set of A.return, and B must belong to the child
// set of B.return.
a = parentA;
b = parentB;
} else {
// The return pointers point to the same fiber. We'll have to use the
// default, slow path: scan the child sets of each parent alternate to see
// which child belongs to which set.
//
// Search parent A's child set
var didFindChild = false;
var _child = parentA.child;
while (_child) {
if (_child === a) {
didFindChild = true;
a = parentA;
b = parentB;
break;
}
if (_child === b) {
didFindChild = true;
b = parentA;
a = parentB;
break;
}
_child = _child.sibling;
}
if (!didFindChild) {
// Search parent B's child set
_child = parentB.child;
while (_child) {
if (_child === a) {
didFindChild = true;
a = parentB;
b = parentA;
break;
}
if (_child === b) {
didFindChild = true;
b = parentB;
a = parentA;
break;
}
_child = _child.sibling;
}
if (!didFindChild) {
throw new Error('Child was not found in either parent set. This indicates a bug ' + 'in React related to the return pointer. Please file an issue.');
}
}
}
if (a.alternate !== b) {
throw new Error("Return fibers should always be each others' alternates. " + 'This error is likely caused by a bug in React. Please file an issue.');
}
} // If the root is not a host container, we're in a disconnected tree. I.e.
// unmounted.
if (a.tag !== HostRoot) {
throw new Error('Unable to find node on an unmounted component.');
}
if (a.stateNode.current === a) {
// We've determined that A is the current branch.
return fiber;
} // Otherwise B has to be current branch.
return alternate;
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
findCurrentFiberUsingSlowPath
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function findCurrentHostFiber(parent) {
var currentParent = findCurrentFiberUsingSlowPath(parent);
return currentParent !== null ? findCurrentHostFiberImpl(currentParent) : null;
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
findCurrentHostFiber
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function findCurrentHostFiberImpl(node) {
// Next we'll drill down this component to find the first HostComponent/Text.
if (node.tag === HostComponent || node.tag === HostText) {
return node;
}
var child = node.child;
while (child !== null) {
var match = findCurrentHostFiberImpl(child);
if (match !== null) {
return match;
}
child = child.sibling;
}
return null;
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
findCurrentHostFiberImpl
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function findCurrentHostFiberWithNoPortals(parent) {
var currentParent = findCurrentFiberUsingSlowPath(parent);
return currentParent !== null ? findCurrentHostFiberWithNoPortalsImpl(currentParent) : null;
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
findCurrentHostFiberWithNoPortals
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function findCurrentHostFiberWithNoPortalsImpl(node) {
// Next we'll drill down this component to find the first HostComponent/Text.
if (node.tag === HostComponent || node.tag === HostText) {
return node;
}
var child = node.child;
while (child !== null) {
if (child.tag !== HostPortal) {
var match = findCurrentHostFiberWithNoPortalsImpl(child);
if (match !== null) {
return match;
}
}
child = child.sibling;
}
return null;
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
findCurrentHostFiberWithNoPortalsImpl
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function injectInternals(internals) {
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
// No DevTools
return false;
}
var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__;
if (hook.isDisabled) {
// This isn't a real property on the hook, but it can be set to opt out
// of DevTools integration and associated warnings and logs.
// https://github.com/facebook/react/issues/3877
return true;
}
if (!hook.supportsFiber) {
{
error('The installed version of React DevTools is too old and will not work ' + 'with the current version of React. Please update React DevTools. ' + 'https://reactjs.org/link/react-devtools');
} // DevTools exists, even though it doesn't support Fiber.
return true;
}
try {
if (enableSchedulingProfiler) {
// Conditionally inject these hooks only if Timeline profiler is supported by this build.
// This gives DevTools a way to feature detect that isn't tied to version number
// (since profiling and timeline are controlled by different feature flags).
internals = assign({}, internals, {
getLaneLabelMap: getLaneLabelMap,
injectProfilingHooks: injectProfilingHooks
});
}
rendererID = hook.inject(internals); // We have successfully injected, so now it is safe to set up hooks.
injectedHook = hook;
} catch (err) {
// Catch all errors because it is unsafe to throw during initialization.
{
error('React instrumentation encountered an error: %s.', err);
}
}
if (hook.checkDCE) {
// This is the real DevTools.
return true;
} else {
// This is likely a hook installed by Fast Refresh runtime.
return false;
}
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
injectInternals
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function onScheduleRoot(root, children) {
{
if (injectedHook && typeof injectedHook.onScheduleFiberRoot === 'function') {
try {
injectedHook.onScheduleFiberRoot(rendererID, root, children);
} catch (err) {
if ( !hasLoggedError) {
hasLoggedError = true;
error('React instrumentation encountered an error: %s', err);
}
}
}
}
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
onScheduleRoot
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function onCommitRoot(root, eventPriority) {
if (injectedHook && typeof injectedHook.onCommitFiberRoot === 'function') {
try {
var didError = (root.current.flags & DidCapture) === DidCapture;
if (enableProfilerTimer) {
var schedulerPriority;
switch (eventPriority) {
case DiscreteEventPriority:
schedulerPriority = ImmediatePriority;
break;
case ContinuousEventPriority:
schedulerPriority = UserBlockingPriority;
break;
case DefaultEventPriority:
schedulerPriority = NormalPriority;
break;
case IdleEventPriority:
schedulerPriority = IdlePriority;
break;
default:
schedulerPriority = NormalPriority;
break;
}
injectedHook.onCommitFiberRoot(rendererID, root, schedulerPriority, didError);
} else {
injectedHook.onCommitFiberRoot(rendererID, root, undefined, didError);
}
} catch (err) {
{
if (!hasLoggedError) {
hasLoggedError = true;
error('React instrumentation encountered an error: %s', err);
}
}
}
}
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
onCommitRoot
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function onPostCommitRoot(root) {
if (injectedHook && typeof injectedHook.onPostCommitFiberRoot === 'function') {
try {
injectedHook.onPostCommitFiberRoot(rendererID, root);
} catch (err) {
{
if (!hasLoggedError) {
hasLoggedError = true;
error('React instrumentation encountered an error: %s', err);
}
}
}
}
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
onPostCommitRoot
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function onCommitUnmount(fiber) {
if (injectedHook && typeof injectedHook.onCommitFiberUnmount === 'function') {
try {
injectedHook.onCommitFiberUnmount(rendererID, fiber);
} catch (err) {
{
if (!hasLoggedError) {
hasLoggedError = true;
error('React instrumentation encountered an error: %s', err);
}
}
}
}
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
onCommitUnmount
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function setIsStrictModeForDevtools(newIsStrictMode) {
{
if (typeof unstable_yieldValue$1 === 'function') {
// We're in a test because Scheduler.unstable_yieldValue only exists
// in SchedulerMock. To reduce the noise in strict mode tests,
// suppress warnings and disable scheduler yielding during the double render
unstable_setDisableYieldValue$1(newIsStrictMode);
setSuppressWarning(newIsStrictMode);
}
if (injectedHook && typeof injectedHook.setStrictMode === 'function') {
try {
injectedHook.setStrictMode(rendererID, newIsStrictMode);
} catch (err) {
{
if (!hasLoggedError) {
hasLoggedError = true;
error('React instrumentation encountered an error: %s', err);
}
}
}
}
}
} // Profiler API hooks
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
setIsStrictModeForDevtools
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function injectProfilingHooks(profilingHooks) {
injectedProfilingHooks = profilingHooks;
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
injectProfilingHooks
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function getLaneLabelMap() {
{
var map = new Map();
var lane = 1;
for (var index = 0; index < TotalLanes; index++) {
var label = getLabelForLane(lane);
map.set(lane, label);
lane *= 2;
}
return map;
}
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
getLaneLabelMap
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function markCommitStarted(lanes) {
{
if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markCommitStarted === 'function') {
injectedProfilingHooks.markCommitStarted(lanes);
}
}
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
markCommitStarted
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function markCommitStopped() {
{
if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markCommitStopped === 'function') {
injectedProfilingHooks.markCommitStopped();
}
}
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
markCommitStopped
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function markComponentRenderStarted(fiber) {
{
if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentRenderStarted === 'function') {
injectedProfilingHooks.markComponentRenderStarted(fiber);
}
}
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
markComponentRenderStarted
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function markComponentRenderStopped() {
{
if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentRenderStopped === 'function') {
injectedProfilingHooks.markComponentRenderStopped();
}
}
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
markComponentRenderStopped
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function markComponentPassiveEffectMountStarted(fiber) {
{
if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentPassiveEffectMountStarted === 'function') {
injectedProfilingHooks.markComponentPassiveEffectMountStarted(fiber);
}
}
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
markComponentPassiveEffectMountStarted
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function markComponentPassiveEffectMountStopped() {
{
if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentPassiveEffectMountStopped === 'function') {
injectedProfilingHooks.markComponentPassiveEffectMountStopped();
}
}
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
markComponentPassiveEffectMountStopped
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function markComponentPassiveEffectUnmountStarted(fiber) {
{
if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentPassiveEffectUnmountStarted === 'function') {
injectedProfilingHooks.markComponentPassiveEffectUnmountStarted(fiber);
}
}
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
markComponentPassiveEffectUnmountStarted
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function markComponentPassiveEffectUnmountStopped() {
{
if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentPassiveEffectUnmountStopped === 'function') {
injectedProfilingHooks.markComponentPassiveEffectUnmountStopped();
}
}
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
markComponentPassiveEffectUnmountStopped
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function markComponentLayoutEffectMountStarted(fiber) {
{
if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentLayoutEffectMountStarted === 'function') {
injectedProfilingHooks.markComponentLayoutEffectMountStarted(fiber);
}
}
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
markComponentLayoutEffectMountStarted
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function markComponentLayoutEffectMountStopped() {
{
if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentLayoutEffectMountStopped === 'function') {
injectedProfilingHooks.markComponentLayoutEffectMountStopped();
}
}
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
markComponentLayoutEffectMountStopped
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function markComponentLayoutEffectUnmountStarted(fiber) {
{
if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentLayoutEffectUnmountStarted === 'function') {
injectedProfilingHooks.markComponentLayoutEffectUnmountStarted(fiber);
}
}
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
markComponentLayoutEffectUnmountStarted
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function markComponentLayoutEffectUnmountStopped() {
{
if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentLayoutEffectUnmountStopped === 'function') {
injectedProfilingHooks.markComponentLayoutEffectUnmountStopped();
}
}
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
markComponentLayoutEffectUnmountStopped
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function markComponentErrored(fiber, thrownValue, lanes) {
{
if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentErrored === 'function') {
injectedProfilingHooks.markComponentErrored(fiber, thrownValue, lanes);
}
}
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
markComponentErrored
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function markComponentSuspended(fiber, wakeable, lanes) {
{
if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentSuspended === 'function') {
injectedProfilingHooks.markComponentSuspended(fiber, wakeable, lanes);
}
}
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
markComponentSuspended
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function markLayoutEffectsStarted(lanes) {
{
if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markLayoutEffectsStarted === 'function') {
injectedProfilingHooks.markLayoutEffectsStarted(lanes);
}
}
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
markLayoutEffectsStarted
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function markLayoutEffectsStopped() {
{
if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markLayoutEffectsStopped === 'function') {
injectedProfilingHooks.markLayoutEffectsStopped();
}
}
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
markLayoutEffectsStopped
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function markPassiveEffectsStarted(lanes) {
{
if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markPassiveEffectsStarted === 'function') {
injectedProfilingHooks.markPassiveEffectsStarted(lanes);
}
}
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
markPassiveEffectsStarted
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function markPassiveEffectsStopped() {
{
if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markPassiveEffectsStopped === 'function') {
injectedProfilingHooks.markPassiveEffectsStopped();
}
}
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
markPassiveEffectsStopped
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function markRenderStarted(lanes) {
{
if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markRenderStarted === 'function') {
injectedProfilingHooks.markRenderStarted(lanes);
}
}
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
markRenderStarted
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function markRenderYielded() {
{
if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markRenderYielded === 'function') {
injectedProfilingHooks.markRenderYielded();
}
}
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
markRenderYielded
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function markRenderStopped() {
{
if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markRenderStopped === 'function') {
injectedProfilingHooks.markRenderStopped();
}
}
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
markRenderStopped
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function markRenderScheduled(lane) {
{
if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markRenderScheduled === 'function') {
injectedProfilingHooks.markRenderScheduled(lane);
}
}
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
markRenderScheduled
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function markForceUpdateScheduled(fiber, lane) {
{
if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markForceUpdateScheduled === 'function') {
injectedProfilingHooks.markForceUpdateScheduled(fiber, lane);
}
}
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
markForceUpdateScheduled
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function markStateUpdateScheduled(fiber, lane) {
{
if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markStateUpdateScheduled === 'function') {
injectedProfilingHooks.markStateUpdateScheduled(fiber, lane);
}
}
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
markStateUpdateScheduled
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function clz32Fallback(x) {
var asUint = x >>> 0;
if (asUint === 0) {
return 32;
}
return 31 - (log(asUint) / LN2 | 0) | 0;
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
clz32Fallback
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function getLabelForLane(lane) {
{
if (lane & SyncLane) {
return 'Sync';
}
if (lane & InputContinuousHydrationLane) {
return 'InputContinuousHydration';
}
if (lane & InputContinuousLane) {
return 'InputContinuous';
}
if (lane & DefaultHydrationLane) {
return 'DefaultHydration';
}
if (lane & DefaultLane) {
return 'Default';
}
if (lane & TransitionHydrationLane) {
return 'TransitionHydration';
}
if (lane & TransitionLanes) {
return 'Transition';
}
if (lane & RetryLanes) {
return 'Retry';
}
if (lane & SelectiveHydrationLane) {
return 'SelectiveHydration';
}
if (lane & IdleHydrationLane) {
return 'IdleHydration';
}
if (lane & IdleLane) {
return 'Idle';
}
if (lane & OffscreenLane) {
return 'Offscreen';
}
}
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
getLabelForLane
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function getHighestPriorityLanes(lanes) {
switch (getHighestPriorityLane(lanes)) {
case SyncLane:
return SyncLane;
case InputContinuousHydrationLane:
return InputContinuousHydrationLane;
case InputContinuousLane:
return InputContinuousLane;
case DefaultHydrationLane:
return DefaultHydrationLane;
case DefaultLane:
return DefaultLane;
case TransitionHydrationLane:
return TransitionHydrationLane;
case TransitionLane1:
case TransitionLane2:
case TransitionLane3:
case TransitionLane4:
case TransitionLane5:
case TransitionLane6:
case TransitionLane7:
case TransitionLane8:
case TransitionLane9:
case TransitionLane10:
case TransitionLane11:
case TransitionLane12:
case TransitionLane13:
case TransitionLane14:
case TransitionLane15:
case TransitionLane16:
return lanes & TransitionLanes;
case RetryLane1:
case RetryLane2:
case RetryLane3:
case RetryLane4:
case RetryLane5:
return lanes & RetryLanes;
case SelectiveHydrationLane:
return SelectiveHydrationLane;
case IdleHydrationLane:
return IdleHydrationLane;
case IdleLane:
return IdleLane;
case OffscreenLane:
return OffscreenLane;
default:
{
error('Should have found matching lanes. This is a bug in React.');
} // This shouldn't be reachable, but as a fallback, return the entire bitmask.
return lanes;
}
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
getHighestPriorityLanes
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function getNextLanes(root, wipLanes) {
// Early bailout if there's no pending work left.
var pendingLanes = root.pendingLanes;
if (pendingLanes === NoLanes) {
return NoLanes;
}
var nextLanes = NoLanes;
var suspendedLanes = root.suspendedLanes;
var pingedLanes = root.pingedLanes; // Do not work on any idle work until all the non-idle work has finished,
// even if the work is suspended.
var nonIdlePendingLanes = pendingLanes & NonIdleLanes;
if (nonIdlePendingLanes !== NoLanes) {
var nonIdleUnblockedLanes = nonIdlePendingLanes & ~suspendedLanes;
if (nonIdleUnblockedLanes !== NoLanes) {
nextLanes = getHighestPriorityLanes(nonIdleUnblockedLanes);
} else {
var nonIdlePingedLanes = nonIdlePendingLanes & pingedLanes;
if (nonIdlePingedLanes !== NoLanes) {
nextLanes = getHighestPriorityLanes(nonIdlePingedLanes);
}
}
} else {
// The only remaining work is Idle.
var unblockedLanes = pendingLanes & ~suspendedLanes;
if (unblockedLanes !== NoLanes) {
nextLanes = getHighestPriorityLanes(unblockedLanes);
} else {
if (pingedLanes !== NoLanes) {
nextLanes = getHighestPriorityLanes(pingedLanes);
}
}
}
if (nextLanes === NoLanes) {
// This should only be reachable if we're suspended
// TODO: Consider warning in this path if a fallback timer is not scheduled.
return NoLanes;
} // If we're already in the middle of a render, switching lanes will interrupt
// it and we'll lose our progress. We should only do this if the new lanes are
// higher priority.
if (wipLanes !== NoLanes && wipLanes !== nextLanes && // If we already suspended with a delay, then interrupting is fine. Don't
// bother waiting until the root is complete.
(wipLanes & suspendedLanes) === NoLanes) {
var nextLane = getHighestPriorityLane(nextLanes);
var wipLane = getHighestPriorityLane(wipLanes);
if ( // Tests whether the next lane is equal or lower priority than the wip
// one. This works because the bits decrease in priority as you go left.
nextLane >= wipLane || // Default priority updates should not interrupt transition updates. The
// only difference between default updates and transition updates is that
// default updates do not support refresh transitions.
nextLane === DefaultLane && (wipLane & TransitionLanes) !== NoLanes) {
// Keep working on the existing in-progress tree. Do not interrupt.
return wipLanes;
}
}
if ((nextLanes & InputContinuousLane) !== NoLanes) {
// When updates are sync by default, we entangle continuous priority updates
// and default updates, so they render in the same batch. The only reason
// they use separate lanes is because continuous updates should interrupt
// transitions, but default updates should not.
nextLanes |= pendingLanes & DefaultLane;
} // Check for entangled lanes and add them to the batch.
//
// A lane is said to be entangled with another when it's not allowed to render
// in a batch that does not also include the other lane. Typically we do this
// when multiple updates have the same source, and we only want to respond to
// the most recent event from that source.
//
// Note that we apply entanglements *after* checking for partial work above.
// This means that if a lane is entangled during an interleaved event while
// it's already rendering, we won't interrupt it. This is intentional, since
// entanglement is usually "best effort": we'll try our best to render the
// lanes in the same batch, but it's not worth throwing out partially
// completed work in order to do it.
// TODO: Reconsider this. The counter-argument is that the partial work
// represents an intermediate state, which we don't want to show to the user.
// And by spending extra time finishing it, we're increasing the amount of
// time it takes to show the final state, which is what they are actually
// waiting for.
//
// For those exceptions where entanglement is semantically important, like
// useMutableSource, we should ensure that there is no partial work at the
// time we apply the entanglement.
var entangledLanes = root.entangledLanes;
if (entangledLanes !== NoLanes) {
var entanglements = root.entanglements;
var lanes = nextLanes & entangledLanes;
while (lanes > 0) {
var index = pickArbitraryLaneIndex(lanes);
var lane = 1 << index;
nextLanes |= entanglements[index];
lanes &= ~lane;
}
}
return nextLanes;
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
getNextLanes
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function getMostRecentEventTime(root, lanes) {
var eventTimes = root.eventTimes;
var mostRecentEventTime = NoTimestamp;
while (lanes > 0) {
var index = pickArbitraryLaneIndex(lanes);
var lane = 1 << index;
var eventTime = eventTimes[index];
if (eventTime > mostRecentEventTime) {
mostRecentEventTime = eventTime;
}
lanes &= ~lane;
}
return mostRecentEventTime;
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
getMostRecentEventTime
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function computeExpirationTime(lane, currentTime) {
switch (lane) {
case SyncLane:
case InputContinuousHydrationLane:
case InputContinuousLane:
// User interactions should expire slightly more quickly.
//
// NOTE: This is set to the corresponding constant as in Scheduler.js.
// When we made it larger, a product metric in www regressed, suggesting
// there's a user interaction that's being starved by a series of
// synchronous updates. If that theory is correct, the proper solution is
// to fix the starvation. However, this scenario supports the idea that
// expiration times are an important safeguard when starvation
// does happen.
return currentTime + 250;
case DefaultHydrationLane:
case DefaultLane:
case TransitionHydrationLane:
case TransitionLane1:
case TransitionLane2:
case TransitionLane3:
case TransitionLane4:
case TransitionLane5:
case TransitionLane6:
case TransitionLane7:
case TransitionLane8:
case TransitionLane9:
case TransitionLane10:
case TransitionLane11:
case TransitionLane12:
case TransitionLane13:
case TransitionLane14:
case TransitionLane15:
case TransitionLane16:
return currentTime + 5000;
case RetryLane1:
case RetryLane2:
case RetryLane3:
case RetryLane4:
case RetryLane5:
// TODO: Retries should be allowed to expire if they are CPU bound for
// too long, but when I made this change it caused a spike in browser
// crashes. There must be some other underlying bug; not super urgent but
// ideally should figure out why and fix it. Unfortunately we don't have
// a repro for the crashes, only detected via production metrics.
return NoTimestamp;
case SelectiveHydrationLane:
case IdleHydrationLane:
case IdleLane:
case OffscreenLane:
// Anything idle priority or lower should never expire.
return NoTimestamp;
default:
{
error('Should have found matching lanes. This is a bug in React.');
}
return NoTimestamp;
}
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
computeExpirationTime
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function markStarvedLanesAsExpired(root, currentTime) {
// TODO: This gets called every time we yield. We can optimize by storing
// the earliest expiration time on the root. Then use that to quickly bail out
// of this function.
var pendingLanes = root.pendingLanes;
var suspendedLanes = root.suspendedLanes;
var pingedLanes = root.pingedLanes;
var expirationTimes = root.expirationTimes; // Iterate through the pending lanes and check if we've reached their
// expiration time. If so, we'll assume the update is being starved and mark
// it as expired to force it to finish.
var lanes = pendingLanes;
while (lanes > 0) {
var index = pickArbitraryLaneIndex(lanes);
var lane = 1 << index;
var expirationTime = expirationTimes[index];
if (expirationTime === NoTimestamp) {
// Found a pending lane with no expiration time. If it's not suspended, or
// if it's pinged, assume it's CPU-bound. Compute a new expiration time
// using the current time.
if ((lane & suspendedLanes) === NoLanes || (lane & pingedLanes) !== NoLanes) {
// Assumes timestamps are monotonically increasing.
expirationTimes[index] = computeExpirationTime(lane, currentTime);
}
} else if (expirationTime <= currentTime) {
// This lane expired
root.expiredLanes |= lane;
}
lanes &= ~lane;
}
} // This returns the highest priority pending lanes regardless of whether they
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
markStarvedLanesAsExpired
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function getHighestPriorityPendingLanes(root) {
return getHighestPriorityLanes(root.pendingLanes);
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
getHighestPriorityPendingLanes
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function getLanesToRetrySynchronouslyOnError(root) {
var everythingButOffscreen = root.pendingLanes & ~OffscreenLane;
if (everythingButOffscreen !== NoLanes) {
return everythingButOffscreen;
}
if (everythingButOffscreen & OffscreenLane) {
return OffscreenLane;
}
return NoLanes;
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
getLanesToRetrySynchronouslyOnError
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function includesSyncLane(lanes) {
return (lanes & SyncLane) !== NoLanes;
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
includesSyncLane
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function includesNonIdleWork(lanes) {
return (lanes & NonIdleLanes) !== NoLanes;
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
includesNonIdleWork
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function includesOnlyRetries(lanes) {
return (lanes & RetryLanes) === lanes;
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
includesOnlyRetries
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function includesOnlyNonUrgentLanes(lanes) {
var UrgentLanes = SyncLane | InputContinuousLane | DefaultLane;
return (lanes & UrgentLanes) === NoLanes;
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
includesOnlyNonUrgentLanes
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function includesOnlyTransitions(lanes) {
return (lanes & TransitionLanes) === lanes;
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
includesOnlyTransitions
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function includesBlockingLane(root, lanes) {
var SyncDefaultLanes = InputContinuousHydrationLane | InputContinuousLane | DefaultHydrationLane | DefaultLane;
return (lanes & SyncDefaultLanes) !== NoLanes;
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
includesBlockingLane
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function includesExpiredLane(root, lanes) {
// This is a separate check from includesBlockingLane because a lane can
// expire after a render has already started.
return (lanes & root.expiredLanes) !== NoLanes;
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
includesExpiredLane
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function isTransitionLane(lane) {
return (lane & TransitionLanes) !== NoLanes;
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
isTransitionLane
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function claimNextTransitionLane() {
// Cycle through the lanes, assigning each new transition to the next lane.
// In most cases, this means every transition gets its own lane, until we
// run out of lanes and cycle back to the beginning.
var lane = nextTransitionLane;
nextTransitionLane <<= 1;
if ((nextTransitionLane & TransitionLanes) === NoLanes) {
nextTransitionLane = TransitionLane1;
}
return lane;
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
claimNextTransitionLane
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function claimNextRetryLane() {
var lane = nextRetryLane;
nextRetryLane <<= 1;
if ((nextRetryLane & RetryLanes) === NoLanes) {
nextRetryLane = RetryLane1;
}
return lane;
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
claimNextRetryLane
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function getHighestPriorityLane(lanes) {
return lanes & -lanes;
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
getHighestPriorityLane
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function pickArbitraryLane(lanes) {
// This wrapper function gets inlined. Only exists so to communicate that it
// doesn't matter which bit is selected; you can pick any bit without
// affecting the algorithms where its used. Here I'm using
// getHighestPriorityLane because it requires the fewest operations.
return getHighestPriorityLane(lanes);
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
pickArbitraryLane
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function pickArbitraryLaneIndex(lanes) {
return 31 - clz32(lanes);
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
pickArbitraryLaneIndex
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
function laneToIndex(lane) {
return pickArbitraryLaneIndex(lane);
}
|
`ReactInstanceMap` maintains a mapping from a public facing stateful
instance (key) and the internal representation (value). This allows public
methods to accept the user facing instance as an argument and map them back
to internal methods.
Note that this module is currently shared and assumed to be stateless.
If this becomes an actual Map, that will break.
|
laneToIndex
|
javascript
|
facebook/memlab
|
packages/lens/src/tests/lib/react-dom-v18.dev.js
|
https://github.com/facebook/memlab/blob/master/packages/lens/src/tests/lib/react-dom-v18.dev.js
|
MIT
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.