Skip to content

Commit

Permalink
fix: ReactDom.creatRoot().render() is not valid
Browse files Browse the repository at this point in the history
  • Loading branch information
saitoChen committed Nov 8, 2023
1 parent 06f81de commit 44429fa
Show file tree
Hide file tree
Showing 5 changed files with 167 additions and 6 deletions.
84 changes: 82 additions & 2 deletions dist/node_modules/react-dom/client.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

84 changes: 82 additions & 2 deletions dist/node_modules/react-dom/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion packages/react-reconciler/src/fiber.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ export const crateWorkInProgress = (
if (wip === null) {
// mount
wip = new FiberNode(current.tag, pendingProps, current.key)
wip.type = current.type
wip.stateNode = current.stateNode

wip.alternate = current
Expand Down
2 changes: 1 addition & 1 deletion packages/react-reconciler/src/updateQueue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const processUpdateQueue = <State>(
if (typeof action === 'function') {
result.memorizedState = (action as (prevState: State) => State)(baseState)
} else {
result.memorizedState = baseState
result.memorizedState = action
}
}

Expand Down
2 changes: 2 additions & 0 deletions packages/react-reconciler/src/workLoop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { beginWork } from './beginWork'
import { completeWork } from './completeWork'
import { HostRoot } from './workTags'
import { MutationMask, NoFlags } from './fiberFlags'
import { commitMutationEffects } from './commitWork'

let workInProgress: FiberNode | null = null

Expand Down Expand Up @@ -76,6 +77,7 @@ const commitRoot = (root: FiberRootNode) => {

// switch fiber tree
// hostRootNode
commitMutationEffects(finishedWork)
root.current = finishedWork
// layout
} else {
Expand Down

0 comments on commit 44429fa

Please sign in to comment.