Skip to content

Commit

Permalink
comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Xiaoji Chen committed Dec 12, 2019
1 parent 9219e82 commit 7c4f823
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
4 changes: 2 additions & 2 deletions modules/core/src/lifecycle/component-state.js
Expand Up @@ -21,8 +21,8 @@
import log from '../utils/log';
import assert from '../utils/assert';
import {isAsyncIterable} from '../utils/iterable-utils';
import {PROP_KEYS} from './constants';
const {ASYNC_ORIGINAL, ASYNC_RESOLVED, ASYNC_DEFAULTS} = PROP_KEYS;
import {PROP_SYMBOLS} from './constants';
const {ASYNC_ORIGINAL, ASYNC_RESOLVED, ASYNC_DEFAULTS} = PROP_SYMBOLS;

const EMPTY_PROPS = Object.freeze({});

Expand Down
4 changes: 2 additions & 2 deletions modules/core/src/lifecycle/component.js
@@ -1,7 +1,7 @@
import {LIFECYCLE} from '../lifecycle/constants';
import {createProps} from './create-props';
import {PROP_KEYS} from './constants';
const {ASYNC_ORIGINAL, ASYNC_RESOLVED, ASYNC_DEFAULTS} = PROP_KEYS;
import {PROP_SYMBOLS} from './constants';
const {ASYNC_ORIGINAL, ASYNC_RESOLVED, ASYNC_DEFAULTS} = PROP_SYMBOLS;
import ComponentState from './component-state';

const defaultProps = {};
Expand Down
2 changes: 1 addition & 1 deletion modules/core/src/lifecycle/constants.js
Expand Up @@ -11,7 +11,7 @@ export const LIFECYCLE = {
// Symbols are non-enumerable by default, does not show in for...in or Object.keys
// but are copied with Object.assign ¯\_(ツ)_/¯
// Supported everywhere except IE11, can be polyfilled with core-js
export const PROP_KEYS = {
export const PROP_SYMBOLS = {
COMPONENT: Symbol('component'),
ASYNC_DEFAULTS: Symbol('asyncPropDefaults'),
ASYNC_ORIGINAL: Symbol('asyncPropOriginal'),
Expand Down
7 changes: 4 additions & 3 deletions modules/core/src/lifecycle/create-props.js
@@ -1,9 +1,9 @@
import log from '../utils/log';
import {isAsyncIterable} from '../utils/iterable-utils';
import {parsePropTypes} from './prop-types';
import {PROP_KEYS} from './constants';
import {PROP_SYMBOLS} from './constants';

const {COMPONENT, ASYNC_ORIGINAL, ASYNC_RESOLVED, ASYNC_DEFAULTS} = PROP_KEYS;
const {COMPONENT, ASYNC_ORIGINAL, ASYNC_RESOLVED, ASYNC_DEFAULTS} = PROP_SYMBOLS;

// Create a property object
export function createProps() {
Expand All @@ -27,7 +27,8 @@ export function createProps() {
// "Copy" all sync props
for (let i = 0; i < arguments.length; ++i) {
const props = arguments[i];
// Do not use Object.assign here to avoid copying Symbols
// Do not use Object.assign here to avoid Symbols in props overwriting our private fields
// This might happen if one of the arguments is another props instance
for (const key in props) {
propsInstance[key] = props[key];
}
Expand Down
4 changes: 2 additions & 2 deletions modules/core/src/lifecycle/props.js
@@ -1,7 +1,7 @@
import assert from '../utils/assert';
import {PROP_KEYS} from './constants';
import {PROP_SYMBOLS} from './constants';

const {COMPONENT} = PROP_KEYS;
const {COMPONENT} = PROP_SYMBOLS;

export function validateProps(props) {
const propTypes = getPropTypes(props);
Expand Down

0 comments on commit 7c4f823

Please sign in to comment.