Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
d9393ee
Add Fragment fiber type
sebmarkbage Sep 13, 2016
e8c1cb4
Add Text node types
sebmarkbage Sep 14, 2016
d7322d8
Silence Fiber warning when the feature flag is on
sebmarkbage Sep 13, 2016
e05ab67
Fix MultiChild tests so they work with Fiber
sebmarkbage Sep 13, 2016
8c7409b
Add comment about bug in yields
sebmarkbage Sep 15, 2016
4ed67f1
Enable text updates in ReactNoop
sebmarkbage Sep 19, 2016
dff0faf
Fiber child reconciliation
sebmarkbage Sep 20, 2016
51f2bf9
Add index field to each fiber
sebmarkbage Sep 21, 2016
bcbceae
Don't track side-effects unless needed
sebmarkbage Sep 21, 2016
c49a91c
Fast path for create child
sebmarkbage Oct 4, 2016
be0acf8
Deletion tracking
sebmarkbage Oct 4, 2016
76725fe
Tag the fiber with the kind of side-effect that was applied to it
sebmarkbage Oct 4, 2016
86e854e
Append deletions to the effect list
sebmarkbage Oct 4, 2016
eabed69
Move child updates to use the reconciled effects
sebmarkbage Oct 5, 2016
31ca1e7
Remove beginWork shortcut
sebmarkbage Oct 6, 2016
0262e70
Reset effect list when we recompute children
sebmarkbage Oct 7, 2016
f3d7116
Always override priority level when visiting children
sebmarkbage Oct 7, 2016
40989f8
Call componentWillUnmount during deletion phase
sebmarkbage Oct 7, 2016
8360088
Fire componentDidMount/componentDidUpdate life-cycles
sebmarkbage Oct 7, 2016
48cf81c
Resolve ref callbacks
sebmarkbage Oct 7, 2016
8721ec1
Invoke all null ref calls before any new ref calls
sebmarkbage Oct 7, 2016
d9efde7
Fix resuming bug
sebmarkbage Oct 10, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Don't track side-effects unless needed
We don't need to track side-effects for a parent that has never
been mounted before. It will simply inject all its children when
it completes.
  • Loading branch information
sebmarkbage committed Oct 17, 2016
commit bcbceaecfa8f937c99ea7ca9f4ea51945a8121bb
94 changes: 46 additions & 48 deletions src/renderers/shared/fiber/ReactChildFiber.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,62 +56,60 @@ const {
NoWork,
} = ReactPriorityLevel;

// This wrapper function exists because I expect to clone the code in each path
// to be able to optimize each path individually by branching early. This needs
// a compiler or we can do it manually. Helpers that don't need this branching
// live outside of this function.
function ChildReconciler(shouldClone, shouldTrackSideEffects) {

function deleteChild(
returnFiber : Fiber,
childToDelete : Fiber
) {
if (!shouldTrackSideEffects) {
// Noop.
return;
}
function deleteChild(
returnFiber : Fiber,
childToDelete : Fiber
) {
if (!shouldTrackSideEffects) {
// Noop.
return;
}

// TODO: Add this child to the side-effect queue for deletion.
}
// TODO: Add this child to the side-effect queue for deletion.
}

function deleteRemainingChildren(
returnFiber : Fiber,
currentFirstChild : ?Fiber
) {
if (!shouldTrackSideEffects) {
// Noop.
function deleteRemainingChildren(
returnFiber : Fiber,
currentFirstChild : ?Fiber
) {
if (!shouldTrackSideEffects) {
// Noop.
return null;
}
// TODO: Add these children to the side-effect queue for deletion.
return null;
}
// TODO: Add these children to the side-effect queue for deletion.
return null;
}

function mapAndDeleteRemainingChildren(
returnFiber : Fiber,
currentFirstChild : ?Fiber
) : Map<string, Fiber> {
// Add the remaining children to a temporary map so that we can find them by
// keys quickly. At the same time, we'll flag them all for deletion. However,
// we will then undo the deletion as we restore children. Implicit (null) keys
// don't get added to this set.
const existingChildren : Map<string, Fiber> = new Map();
let existingChild = currentFirstChild;
while (existingChild) {
if (existingChild.key !== null) {
existingChildren.set(existingChild.key, existingChild);
function mapAndDeleteRemainingChildren(
returnFiber : Fiber,
currentFirstChild : ?Fiber
) : Map<string, Fiber> {
// Add the remaining children to a temporary map so that we can find them by
// keys quickly. At the same time, we'll flag them all for deletion. However,
// we will then undo the deletion as we restore children. Implicit (null) keys
// don't get added to this set.
const existingChildren : Map<string, Fiber> = new Map();
let existingChild = currentFirstChild;
while (existingChild) {
if (existingChild.key !== null) {
existingChildren.set(existingChild.key, existingChild);
}
// Add everything to the delete queue
// Actually... It is not possible to delete things from the queue since
// we don't have access to the previous link. Does that mean we need a
// second pass to add them? We should be able to keep track of the
// previous deletion as we're iterating through the list the next time.
// That way we know which item to patch when we delete a deletion.
existingChild = existingChild.sibling;
}
// Add everything to the delete queue
// Actually... It is not possible to delete things from the queue since
// we don't have access to the previous link. Does that mean we need a
// second pass to add them? We should be able to keep track of the
// previous deletion as we're iterating through the list the next time.
// That way we know which item to patch when we delete a deletion.
existingChild = existingChild.sibling;
return existingChildren;
}
return existingChildren;
}


// This wrapper function exists because I expect to clone the code in each path
// to be able to optimize each path individually by branching early. This needs
// a compiler or we can do it manually. Helpers that don't need this branching
// live outside of this function.
function ChildReconciler(shouldClone, shouldTrackSideEffects) {

function useFiber(fiber : Fiber, priority : PriorityLevel) {
// We currently set sibling to null and index to 0 here because it is easy
Expand Down