Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fiber] State Updates #7941

Merged
merged 3 commits into from
Oct 17, 2016
Merged

Conversation

sebmarkbage
Copy link
Collaborator

I'm putting some work into state updates since there is currently a bug that I haven't been able to track down. Builds on top #7707.

  • Move scheduler and updater code out of beginWork.
  • Use two different update queues for current / wip so that we can abort low pri state updates.
  • Fix bug with deep setState being deferred. Reproducable in the demo.

@acdlite
Copy link
Collaborator

acdlite commented Oct 11, 2016

Looks good! 👍

@acdlite
Copy link
Collaborator

acdlite commented Oct 11, 2016

Oh oops didn't see you still have steps to do. Commits so far look good.

@sebmarkbage
Copy link
Collaborator Author

Well at this point maybe we need quicker turn around on PRs for collaboration.

@@ -291,7 +291,7 @@ module.exports = function<T, P, I, TI, C>(config : HostConfig<T, P, I, TI, C>) {
const prevProps = current.memoizedProps;
// TODO: This is the new state. We don't currently have the previous
// state anymore.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can remove this TODO

@gaearon
Copy link
Collaborator

gaearon commented Oct 17, 2016

Can we get it merged as is for now? It's hard to fix/test/explore Fiber with massive changes hanging in a PR. I don't think anybody expects it to be perfect.

@acdlite
Copy link
Collaborator

acdlite commented Oct 17, 2016

Agreed, the existing commits are useful even without the remaining steps.

@acdlite
Copy link
Collaborator

acdlite commented Oct 17, 2016

I'm going to mark this as accepted to indicate that the existing commits should be merged, but if you disagree @sebmarkbage feel free to remove it.

Refactors the class logic a bit.

I moved scheduleUpdate out into the scheduler since that's where
the scheduling normally happens. I also moved it so that we can
rely on hoisting to resolve the cycle statically.

I moved the updater to a new class component file. I suspect we
will need a bit of space in here since the class initialization
code is quite complex.

The class component dependency is currently fixed in BeginWork
so we can't move complete or commit phase stuff to it. If we need
to, we have to initialize it in the scheduler and pass it to the
other phases.
The root is always a host container.
We forgot to clone this value so it didn't work before.
This is covered by existing tests in ReactDOMProduction.
@sebmarkbage
Copy link
Collaborator Author

Cool I'll continue in a new PR. I have found another bug.

@sebmarkbage sebmarkbage merged commit fae3e53 into facebook:master Oct 17, 2016
@sebmarkbage sebmarkbage changed the title [WIP][Fiber] State Updates [Fiber] State Updates Oct 17, 2016
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