Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions packages/react-dom/src/client/ReactDOMFiberComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// TODO: direct imports like some-package/src/* are bad. Fix me.
import {
getCurrentFiberOwnerNameInDevOrNull,
getCurrentFiberStackInDevOrNull,
getCurrentFiberStackInDev,
} from 'react-reconciler/src/ReactCurrentFiber';
import {registrationNameModules} from 'events/EventPluginRegistry';
import warning from 'shared/warning';
Expand Down Expand Up @@ -61,7 +61,7 @@ const HTML = '__html';

const {html: HTML_NAMESPACE} = Namespaces;

let getStackInDevOrNull = () => '';
let getStackInDev = () => '';

let warnedUnknownTags;
let suppressHydrationWarning;
Expand All @@ -76,7 +76,7 @@ let normalizeMarkupForTextOrAttribute;
let normalizeHTML;

if (__DEV__) {
getStackInDevOrNull = getCurrentFiberStackInDevOrNull;
getStackInDev = getCurrentFiberStackInDev;

warnedUnknownTags = {
// Chrome is the only major browser not shipping <time>. But as of July
Expand Down Expand Up @@ -180,15 +180,15 @@ if (__DEV__) {
registrationName,
registrationName,
registrationName,
getCurrentFiberStackInDevOrNull(),
getCurrentFiberStackInDev(),
);
} else {
warning(
false,
'Expected `%s` listener to be a function, instead got a value of `%s` type.%s',
registrationName,
typeof listener,
getCurrentFiberStackInDevOrNull(),
getCurrentFiberStackInDev(),
);
}
};
Expand Down Expand Up @@ -269,7 +269,7 @@ function setInitialDOMProperties(
CSSPropertyOperations.setValueForStyles(
domElement,
nextProp,
getStackInDevOrNull,
getStackInDev,
);
} else if (propKey === DANGEROUSLY_SET_INNER_HTML) {
const nextHtml = nextProp ? nextProp[HTML] : undefined;
Expand Down Expand Up @@ -329,7 +329,7 @@ function updateDOMProperties(
CSSPropertyOperations.setValueForStyles(
domElement,
propValue,
getStackInDevOrNull,
getStackInDev,
);
} else if (propKey === DANGEROUSLY_SET_INNER_HTML) {
setInnerHTML(domElement, propValue);
Expand Down Expand Up @@ -523,7 +523,7 @@ export function setInitialProperties(
props = rawProps;
}

assertValidProps(tag, props, getStackInDevOrNull);
assertValidProps(tag, props, getStackInDev);

setInitialDOMProperties(
tag,
Expand Down Expand Up @@ -611,7 +611,7 @@ export function diffProperties(
break;
}

assertValidProps(tag, nextProps, getStackInDevOrNull);
assertValidProps(tag, nextProps, getStackInDev);

let propKey;
let styleName;
Expand Down Expand Up @@ -902,7 +902,7 @@ export function diffHydratedProperties(
break;
}

assertValidProps(tag, rawProps, getStackInDevOrNull);
assertValidProps(tag, rawProps, getStackInDev);

if (__DEV__) {
extraAttributeNames = new Set();
Expand Down
8 changes: 4 additions & 4 deletions packages/react-dom/src/client/ReactDOMFiberInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// TODO: direct imports like some-package/src/* are bad. Fix me.
import {
getCurrentFiberOwnerNameInDevOrNull,
getCurrentFiberStackInDevOrNull,
getCurrentFiberStackInDev,
} from 'react-reconciler/src/ReactCurrentFiber';
import invariant from 'shared/invariant';
import warning from 'shared/warning';
Expand Down Expand Up @@ -74,7 +74,7 @@ export function initWrapperState(element: Element, props: Object) {
ReactControlledValuePropTypes.checkPropTypes(
'input',
props,
getCurrentFiberStackInDevOrNull,
getCurrentFiberStackInDev,
);

if (
Expand Down Expand Up @@ -153,7 +153,7 @@ export function updateWrapper(element: Element, props: Object) {
'Decide between using a controlled or uncontrolled input ' +
'element for the lifetime of the component. More info: https://fb.me/react-controlled-components%s',
props.type,
getCurrentFiberStackInDevOrNull(),
getCurrentFiberStackInDev(),
);
didWarnUncontrolledToControlled = true;
}
Expand All @@ -169,7 +169,7 @@ export function updateWrapper(element: Element, props: Object) {
'Decide between using a controlled or uncontrolled input ' +
'element for the lifetime of the component. More info: https://fb.me/react-controlled-components%s',
props.type,
getCurrentFiberStackInDevOrNull(),
getCurrentFiberStackInDev(),
);
didWarnControlledToUncontrolled = true;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/react-dom/src/client/ReactDOMFiberSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// TODO: direct imports like some-package/src/* are bad. Fix me.
import {
getCurrentFiberOwnerNameInDevOrNull,
getCurrentFiberStackInDevOrNull,
getCurrentFiberStackInDev,
} from 'react-reconciler/src/ReactCurrentFiber';
import warning from 'shared/warning';

Expand Down Expand Up @@ -46,7 +46,7 @@ function checkSelectPropTypes(props) {
ReactControlledValuePropTypes.checkPropTypes(
'select',
props,
getCurrentFiberStackInDevOrNull,
getCurrentFiberStackInDev,
);

for (let i = 0; i < valuePropNames.length; i++) {
Expand Down
4 changes: 2 additions & 2 deletions packages/react-dom/src/client/ReactDOMFiberTextarea.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import invariant from 'shared/invariant';
import warning from 'shared/warning';
// TODO: direct imports like some-package/src/* are bad. Fix me.
import {getCurrentFiberStackInDevOrNull} from 'react-reconciler/src/ReactCurrentFiber';
import {getCurrentFiberStackInDev} from 'react-reconciler/src/ReactCurrentFiber';

import ReactControlledValuePropTypes from '../shared/ReactControlledValuePropTypes';

Expand Down Expand Up @@ -67,7 +67,7 @@ export function initWrapperState(element: Element, props: Object) {
ReactControlledValuePropTypes.checkPropTypes(
'textarea',
props,
getCurrentFiberStackInDevOrNull,
getCurrentFiberStackInDev,
);
if (
props.value !== undefined &&
Expand Down
4 changes: 2 additions & 2 deletions packages/react-dom/src/client/validateDOMNesting.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import warning from 'shared/warning';
// TODO: direct imports like some-package/src/* are bad. Fix me.
import {getCurrentFiberStackInDevOrNull} from 'react-reconciler/src/ReactCurrentFiber';
import {getCurrentFiberStackInDev} from 'react-reconciler/src/ReactCurrentFiber';

let validateDOMNesting = () => {};

Expand Down Expand Up @@ -426,7 +426,7 @@ if (__DEV__) {
}

const ancestorTag = invalidParentOrAncestor.tag;
const addendum = getCurrentFiberStackInDevOrNull();
const addendum = getCurrentFiberStackInDev();

const warnKey =
!!invalidParent + '|' + childTag + '|' + ancestorTag + '|' + addendum;
Expand Down
15 changes: 5 additions & 10 deletions packages/react-dom/src/shared/ReactDOMInvalidARIAHook.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ const rARIACamel = new RegExp('^(aria)[A-Z][' + ATTRIBUTE_NAME_CHAR + ']*$');

const hasOwnProperty = Object.prototype.hasOwnProperty;

function getStackAddendum() {
const stack = ReactDebugCurrentFrame.getStackAddendum();
return stack != null ? stack : '';
}

function validateProperty(tagName, name) {
if (hasOwnProperty.call(warnedProperties, name) && warnedProperties[name]) {
return true;
Expand All @@ -41,7 +36,7 @@ function validateProperty(tagName, name) {
false,
'Invalid ARIA attribute `%s`. ARIA attributes follow the pattern aria-* and must be lowercase.%s',
name,
getStackAddendum(),
ReactDebugCurrentFrame.getStackAddendum(),
);
warnedProperties[name] = true;
return true;
Expand All @@ -53,7 +48,7 @@ function validateProperty(tagName, name) {
'Invalid ARIA attribute `%s`. Did you mean `%s`?%s',
name,
correctName,
getStackAddendum(),
ReactDebugCurrentFrame.getStackAddendum(),
);
warnedProperties[name] = true;
return true;
Expand All @@ -79,7 +74,7 @@ function validateProperty(tagName, name) {
'Unknown ARIA attribute `%s`. Did you mean `%s`?%s',
name,
standardName,
getStackAddendum(),
ReactDebugCurrentFrame.getStackAddendum(),
);
warnedProperties[name] = true;
return true;
Expand Down Expand Up @@ -110,7 +105,7 @@ function warnInvalidARIAProps(type, props) {
'For details, see https://fb.me/invalid-aria-prop%s',
unknownPropString,
type,
getStackAddendum(),
ReactDebugCurrentFrame.getStackAddendum(),
);
} else if (invalidProps.length > 1) {
warning(
Expand All @@ -119,7 +114,7 @@ function warnInvalidARIAProps(type, props) {
'For details, see https://fb.me/invalid-aria-prop%s',
unknownPropString,
type,
getStackAddendum(),
ReactDebugCurrentFrame.getStackAddendum(),
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ import warning from 'shared/warning';

let didWarnValueNull = false;

function getStackAddendum() {
const stack = ReactDebugCurrentFrame.getStackAddendum();
return stack != null ? stack : '';
}

export function validateProperties(type, props) {
if (type !== 'input' && type !== 'textarea' && type !== 'select') {
return;
Expand All @@ -29,7 +24,7 @@ export function validateProperties(type, props) {
'Consider using an empty array when `multiple` is set to `true` ' +
'to clear the component or `undefined` for uncontrolled components.%s',
type,
getStackAddendum(),
ReactDebugCurrentFrame.getStackAddendum(),
);
} else {
warning(
Expand All @@ -38,7 +33,7 @@ export function validateProperties(type, props) {
'Consider using an empty string to clear the component or `undefined` ' +
'for uncontrolled components.%s',
type,
getStackAddendum(),
ReactDebugCurrentFrame.getStackAddendum(),
);
}
}
Expand Down
27 changes: 11 additions & 16 deletions packages/react-dom/src/shared/ReactDOMUnknownPropertyHook.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ import {
import isCustomComponent from './isCustomComponent';
import possibleStandardNames from './possibleStandardNames';

function getStackAddendum() {
const stack = ReactDebugCurrentFrame.getStackAddendum();
return stack != null ? stack : '';
}

let validateProperty = () => {};

if (__DEV__) {
Expand Down Expand Up @@ -69,7 +64,7 @@ if (__DEV__) {
'Invalid event handler property `%s`. Did you mean `%s`?%s',
name,
registrationName,
getStackAddendum(),
ReactDebugCurrentFrame.getStackAddendum(),
);
warnedProperties[name] = true;
return true;
Expand All @@ -79,7 +74,7 @@ if (__DEV__) {
false,
'Unknown event handler property `%s`. It will be ignored.%s',
name,
getStackAddendum(),
ReactDebugCurrentFrame.getStackAddendum(),
);
warnedProperties[name] = true;
return true;
Expand All @@ -94,7 +89,7 @@ if (__DEV__) {
'Invalid event handler property `%s`. ' +
'React events use the camelCase naming convention, for example `onClick`.%s',
name,
getStackAddendum(),
ReactDebugCurrentFrame.getStackAddendum(),
);
}
warnedProperties[name] = true;
Expand Down Expand Up @@ -137,7 +132,7 @@ if (__DEV__) {
'Received a `%s` for a string attribute `is`. If this is expected, cast ' +
'the value to a string.%s',
typeof value,
getStackAddendum(),
ReactDebugCurrentFrame.getStackAddendum(),
);
warnedProperties[name] = true;
return true;
Expand All @@ -149,7 +144,7 @@ if (__DEV__) {
'Received NaN for the `%s` attribute. If this is expected, cast ' +
'the value to a string.%s',
name,
getStackAddendum(),
ReactDebugCurrentFrame.getStackAddendum(),
);
warnedProperties[name] = true;
return true;
Expand All @@ -167,7 +162,7 @@ if (__DEV__) {
'Invalid DOM property `%s`. Did you mean `%s`?%s',
name,
standardName,
getStackAddendum(),
ReactDebugCurrentFrame.getStackAddendum(),
);
warnedProperties[name] = true;
return true;
Expand All @@ -184,7 +179,7 @@ if (__DEV__) {
'it from the DOM element.%s',
name,
lowerCasedName,
getStackAddendum(),
ReactDebugCurrentFrame.getStackAddendum(),
);
warnedProperties[name] = true;
return true;
Expand All @@ -205,7 +200,7 @@ if (__DEV__) {
name,
value,
name,
getStackAddendum(),
ReactDebugCurrentFrame.getStackAddendum(),
);
} else {
warning(
Expand All @@ -222,7 +217,7 @@ if (__DEV__) {
name,
name,
name,
getStackAddendum(),
ReactDebugCurrentFrame.getStackAddendum(),
);
}
warnedProperties[name] = true;
Expand Down Expand Up @@ -265,7 +260,7 @@ const warnUnknownProperties = function(type, props, canUseEventSystem) {
'For details, see https://fb.me/react-attribute-behavior%s',
unknownPropString,
type,
getStackAddendum(),
ReactDebugCurrentFrame.getStackAddendum(),
);
} else if (unknownProps.length > 1) {
warning(
Expand All @@ -275,7 +270,7 @@ const warnUnknownProperties = function(type, props, canUseEventSystem) {
'For details, see https://fb.me/react-attribute-behavior%s',
unknownPropString,
type,
getStackAddendum(),
ReactDebugCurrentFrame.getStackAddendum(),
);
}
};
Expand Down
Loading