Skip to content

Commit 2c684f0

Browse files
author
Brian Vaughn
committed
ReactFiberStack cursor values are no longer corrupted on pop
1 parent 2bea981 commit 2c684f0

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/renderers/shared/fiber/ReactFiberStack.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,33 +55,33 @@ exports.pop = function<T>(
5555
}
5656
}
5757

58+
cursor.current = index > 0
59+
? valueStack[index]
60+
: (null : any);
61+
5862
valueStack[index] = null;
5963

6064
if (__DEV__) {
6165
fiberStack[index] = null;
6266
}
6367

6468
index--;
65-
66-
cursor.current = index > -1
67-
? valueStack[index]
68-
: (null : any);
6969
};
7070

7171
exports.push = function<T>(
7272
cursor : StackCursor<T>,
7373
value : any,
7474
fiber: Fiber,
7575
) : void {
76-
cursor.current = value;
77-
7876
index++;
7977

80-
valueStack[index] = value;
78+
valueStack[index] = cursor.current;
8179

8280
if (__DEV__) {
8381
fiberStack[index] = fiber;
8482
}
83+
84+
cursor.current = value;
8585
};
8686

8787
exports.reset = function<T>(

0 commit comments

Comments
 (0)