Move `getNextDebugID()` to React package. #9005

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
5 participants
@wacii
Contributor

wacii commented Feb 15, 2017

See #8487

When multiple renderers are used in development, react issues a warning from ReactComponentTreeHook.

Why?

Items are stored in ReactComponentTreeHook's itemMap for debug info during development. The keys for these entries are generated by the following code.

var nextDebugID = 1;

function getNextDebugID() {
  return nextDebugID++;
}

The problem is both ReactDOM and ReactDOMServer have a copy of this, and so will generate the same series of numbers, overwriting the debug entries generated by the other.

Now it lives only in React.

@gaearon

This comment has been minimized.

Show comment
Hide comment
@gaearon

gaearon Mar 1, 2017

Member

Thanks! I added this to list of changes we want to push out in 15.5.
Do you think you could rebase this on master?

Member

gaearon commented Mar 1, 2017

Thanks! I added this to list of changes we want to push out in 15.5.
Do you think you could rebase this on master?

@sebmarkbage

sebmarkbage approved these changes Mar 1, 2017 edited

Don't like. Another stateful module in isomorphic wish we tried hard to get away from (e.g. current owner). :(

@gaearon

This comment has been minimized.

Show comment
Hide comment
@gaearon

gaearon Mar 1, 2017

Member

It should die with the tree hook, I think?

Member

gaearon commented Mar 1, 2017

It should die with the tree hook, I think?

Move `getNextDebugID()` to React package.
The module, and its internal state, was duplicated in several packages,
leading to duplicate ids when multiple renderers were used.
@wacii

This comment has been minimized.

Show comment
Hide comment
@wacii

wacii Mar 3, 2017

Contributor

The code is now up to date.

Contributor

wacii commented Mar 3, 2017

The code is now up to date.

@gaearon gaearon added this to the 15-hipri milestone Mar 3, 2017

@gaearon gaearon added the semver-patch label Mar 3, 2017

@@ -0,0 +1,9 @@
+/**

This comment has been minimized.

@gaearon

gaearon Mar 3, 2017

Member

What is this file? Looks like a build product that shouldn't be checked in.

@gaearon

gaearon Mar 3, 2017

Member

What is this file? Looks like a build product that shouldn't be checked in.

This comment has been minimized.

@wacii

wacii Mar 3, 2017

Contributor

See #9078.

It does look that way. But shared modules are now accessed under their package name, so require('react/lib/getNextDebugID') instead of require('getNextDebugID'). Why this was done with an extra module, what @sebmarkbage referred to as forwarding modules I believe, and not an alias...I have no idea.

@wacii

wacii Mar 3, 2017

Contributor

See #9078.

It does look that way. But shared modules are now accessed under their package name, so require('react/lib/getNextDebugID') instead of require('getNextDebugID'). Why this was done with an extra module, what @sebmarkbage referred to as forwarding modules I believe, and not an alias...I have no idea.

This comment has been minimized.

@sebmarkbage

sebmarkbage Mar 3, 2017

Member

Yea. This is correct. When we switch to lerna or yarn workspaces, this will be generated by tooling but since we don't have the tooling in place yet, I just checked in forwarding modules.

@sebmarkbage

sebmarkbage Mar 3, 2017

Member

Yea. This is correct. When we switch to lerna or yarn workspaces, this will be generated by tooling but since we don't have the tooling in place yet, I just checked in forwarding modules.

This comment has been minimized.

@sebmarkbage

sebmarkbage Mar 3, 2017

Member

Forwarding modules is so much better than config aliases because it covers all tooling at once. E.g. webpack aliases are the worst because you have to replicate it in node, jest, flow, and anything else that need the module graph.

@sebmarkbage

sebmarkbage Mar 3, 2017

Member

Forwarding modules is so much better than config aliases because it covers all tooling at once. E.g. webpack aliases are the worst because you have to replicate it in node, jest, flow, and anything else that need the module graph.

This comment has been minimized.

@gaearon

gaearon Mar 3, 2017

Member

Aah. Thanks for explaining.

@gaearon

gaearon Mar 3, 2017

Member

Aah. Thanks for explaining.

This comment has been minimized.

@gaearon

gaearon Mar 3, 2017

Member

(That's the same reason we don't allow absolute imports via Webpack config in CRA 😄 )

@gaearon

gaearon Mar 3, 2017

Member

(That's the same reason we don't allow absolute imports via Webpack config in CRA 😄 )

@acdlite

This comment has been minimized.

Show comment
Hide comment
@acdlite

acdlite Apr 6, 2017

Member

I cherry-picked this onto our release branch. It will go out in 15.5. Thanks!

Member

acdlite commented Apr 6, 2017

I cherry-picked this onto our release branch. It will go out in 15.5. Thanks!

@acdlite acdlite closed this Apr 6, 2017

@bvaughn bvaughn referenced this pull request Aug 1, 2017

Closed

React 16 RC #10294

@renovate renovate bot referenced this pull request in signavio/backbone-rel Feb 2, 2018

Open

Update dependency react to v16 #29

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