Skip to content

Conversation

@gebilaoxiong
Copy link
Contributor

@gebilaoxiong gebilaoxiong commented Sep 5, 2018

There is a small problem with the judgment here.

When we define key in props we use the descriptor like this

  Object.defineProperty(props, 'key', {
    get: warnAboutAccessingKey,
    configurable: true,
  });

When enumerable is not defined, the default value is false.
doc: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty

So when we use Object.keys to get the fragement props, we will never get the key.
code: https://github.com/facebook/react/blob/master/packages/react/src/ReactElementValidator.js#L239

@pull-bot
Copy link

pull-bot commented Sep 5, 2018

Details of bundled changes.

Comparing: 9a110eb...91a971b

schedule

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
schedule.development.js n/a n/a 0 B 19.17 KB 0 B 5.74 KB UMD_DEV
schedule.production.min.js n/a n/a 0 B 3.16 KB 0 B 1.53 KB UMD_PROD

Generated by 🚫 dangerJS

@gaearon
Copy link
Collaborator

gaearon commented Sep 5, 2018

What's the point of specifying the default value explicitly?

@gebilaoxiong
Copy link
Contributor Author

gebilaoxiong commented Sep 5, 2018

@gaearon

If we continue to use Object.keys later
We can intuitively find there is no need to judge key and ref..

If it is not necessary, I can remove it.

@gebilaoxiong gebilaoxiong force-pushed the remove-unnecessary-condition branch from 7aef631 to 91a971b Compare September 7, 2018 13:24
@stale
Copy link

stale bot commented Jan 10, 2020

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed Resolution: Stale Automatically closed due to inactivity

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants