Skip to content

Conversation

@gaearon
Copy link
Collaborator

@gaearon gaearon commented Aug 20, 2018

I empathize with @sebmarkbage's concerns and I did the work of updating DevTools in facebook/react-devtools#1101.

But it turns RN's hot reloading transform also depends on this. It doesn't know the React version. We already have three forks of this transform (one forked by metro, and the original one has two versions that different tools depend on). That transform only depends on a single constant — ClassComponent being 2. Please don't make me re-release all of those. It's a huge timesink. It'll go away by itself when we have a better strategy for hot reloading, but for now let me keep this one constant.

Copy link
Contributor

@bvaughn bvaughn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't object to this change! but it seems like Sebastian might also want a chance to weigh in.

export const ClassComponentLazy = 4;
export const FunctionalComponent = 0;
export const FunctionalComponentLazy = 1;
export const ClassComponent = 2;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should have a big bold inline comment explaining the significance of 2

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know why I added the word "bold" 🤡

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it'll be hard to miss any changes because they broke so much in internal tests (e.g. enzyme). We're also already very intentional about changing these constants.

If we merge this, it'll be just a temporary concession. We still have to "get our act together" later.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still think an inline comment might be helpful to avoid situations like the one that just happened (person A changing this, and person B discovering a few days later that it causes a lot of churn)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the one that just happened seemed pretty intentional 😈 We should still fix this. If you feel strongly please feel free to send PR with a comment you'd find valuable. Maybe something like // Dependencies: *. But I'm also wary of making it seem like these are untouchable.

@gaearon gaearon merged commit e8571c7 into facebook:master Aug 20, 2018
@gaearon
Copy link
Collaborator Author

gaearon commented Aug 20, 2018

I'm going to merge this. If @sebmarkbage or @acdlite feel strongly against — let's chat tomorrow, but I think this shouldn't block the sync. If we want to change it, let's update the dependencies first, and then land an incompatible change into master.

@gaearon
Copy link
Collaborator Author

gaearon commented Aug 20, 2018

Also this change shouldn't make the jump table situation worse.

@sebmarkbage
Copy link
Collaborator

sebmarkbage commented Aug 20, 2018

Honestly half the reason to land this is to intentionally cause pain. The problem with these hacks is that there is not strong enough incentive to avoid them. So we keep landing more and more of them.

The consequence is that we limit optimizations and make it harder to work in the core which is a cost for everyone downstream.

In the end, we feel that we can’t land things upstream so all the incentive is aligned with making the core worse over time.

This is a bad Nash equilibrium to be in. The way to solve such situations is to come up with artificial constraints to break the equivilibrium. In this case, causing friction until the incentive is to fix it downstream or more likely exposing a public api that works with both. Although a public api can’t predict new types of work (such as the lazy one).

While this one is simple. We’re about to add and refactor several types of work. The lazy component is just one aspect of that. This will come up as a true blocker soon so we better unbreak now.

IMO this is now the highest priority task.

@gaearon
Copy link
Collaborator Author

gaearon commented Aug 20, 2018

I'll follow up this week with a proper fix. I don't want to keep master in an unsyncable state though.

gaearon added a commit to facebook/react-devtools that referenced this pull request Aug 20, 2018
gaearon added a commit to facebook/react-devtools that referenced this pull request Aug 20, 2018
* Update constants to match facebook/react#13444

* Update constants and support Lazy

* Fix lint
OrDuan pushed a commit to OrDuan/react-devtools that referenced this pull request Aug 23, 2018
* Update constants to match facebook/react#13444

* Update constants and support Lazy

* Fix lint
@gaearon
Copy link
Collaborator Author

gaearon commented Aug 29, 2018

For future reference: it shouldn't matter anymore and 2 is not special. I could revert this but it's probably not worth churning the DevTools detection.

@gaearon gaearon deleted the tow branch August 29, 2018 14:38
bestlucky0825 pushed a commit to bestlucky0825/react-devtools that referenced this pull request Jun 1, 2022
* Update constants to match facebook/react#13444

* Update constants and support Lazy

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants