|
1 | 1 | /**
|
2 | 2 | * This file contains core module functionality.
|
3 |
| - * |
| 3 | + * |
4 | 4 | * It exports an anonymous
|
5 | 5 | * @function
|
6 | 6 | * that is invoked on
|
7 | 7 | * @param snap --> Current snapshot
|
8 | 8 | * @param mode --> Current mode (jumping i.e. time-traveling, locked, or paused)
|
9 | 9 | * and @returns a function to be invoked on the rootContainer HTMLElement
|
10 |
| - * |
| 10 | + * |
11 | 11 | * @function updateSnapShotTree
|
12 | 12 | * --> Middleware #1: Updates snap object with latest snapshot
|
13 |
| - * |
| 13 | + * |
14 | 14 | * @function sendSnapshot
|
15 | 15 | * --> Middleware #2: Gets a copy of the current snapshot state tree and posts it to the window
|
16 |
| - * |
| 16 | + * |
17 | 17 | * @function changeSetState
|
18 | 18 | * @param component : stateNode property on a stateful class component's FiberNode object
|
19 | 19 | * --> Binds class component setState method to the component
|
20 | 20 | * --> Injects middleware into class component's setState method
|
21 |
| - * |
| 21 | + * |
22 | 22 | * @function changeUseState
|
23 | 23 | * @param component : memoizedState property on a stateful functional component's FiberNode object
|
24 | 24 | * --> Binds functional component dispatch method to the component
|
25 | 25 | * --> Injects middleware into component's dispatch method
|
26 | 26 | * Note: dispatch is hook equivalent to setState()
|
27 |
| - * |
| 27 | + * |
28 | 28 | * @function traverseHooks
|
29 |
| - * @param memoizedState : memoizedState property on a stateful functional component's FiberNode object |
| 29 | + * @param memoizedState : memoizedState property on a stateful fctnl component's FiberNode object |
30 | 30 | * --> Helper function to traverse through memoizedState
|
31 | 31 | * --> Invokes @changeUseState on each stateful functional component
|
32 |
| - * |
| 32 | + * |
33 | 33 | * @function createTree
|
34 | 34 | * @param currentFiber : a FiberNode object
|
35 | 35 | * --> Recursive function to traverse from FiberRootNode and create
|
@@ -92,7 +92,7 @@ module.exports = (snap, mode) => {
|
92 | 92 | component.queue.dispatch = (fiber, queue, action) => {
|
93 | 93 | if (mode.locked && !mode.jumping) return;
|
94 | 94 | oldDispatch(fiber, queue, action);
|
95 |
| - // * Uncomment setTimeout to prevent snapshot lag-effect |
| 95 | + // * Uncomment setTimeout to prevent snapshot lag-effect |
96 | 96 | // * (i.e. getting the prior snapshot on each state change)
|
97 | 97 | // setTimeout(() => {
|
98 | 98 | updateSnapShotTree();
|
@@ -147,8 +147,8 @@ module.exports = (snap, mode) => {
|
147 | 147 |
|
148 | 148 | // Check if the component uses hooks
|
149 | 149 | if (
|
150 |
| - memoizedState && |
151 |
| - Object.hasOwnProperty.call(memoizedState, 'baseState') |
| 150 | + memoizedState |
| 151 | + && Object.hasOwnProperty.call(memoizedState, 'baseState') |
152 | 152 | ) {
|
153 | 153 | // 'catch-all' for suspense elements (experimental)
|
154 | 154 | if (typeof elementType.$$typeof === 'symbol') return;
|
@@ -190,7 +190,7 @@ module.exports = (snap, mode) => {
|
190 | 190 | }
|
191 | 191 |
|
192 | 192 | return async container => {
|
193 |
| - // Point fiberRoot to FiberRootNode |
| 193 | + // Point fiberRoot to FiberRootNode |
194 | 194 | if (container._internalRoot) {
|
195 | 195 | fiberRoot = container._internalRoot;
|
196 | 196 | concurrent = true;
|
|
0 commit comments