Skip to content

Commit a185494

Browse files
committed
fix: correct memo fiber updater, fixes #1230
1 parent a6ba488 commit a185494

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/internal/getReactStack.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import ReactDOM from 'react-dom';
33

44
import hydrateFiberStack from './stack/hydrateFiberStack';
55
import hydrateLegacyStack from './stack/hydrateLegacyStack';
6-
import { getInternalInstance } from './reactUtils';
6+
import { getInternalInstance, updateInstance } from './reactUtils';
77

88
function getReactStack(instance) {
99
const rootNode = getInternalInstance(instance);
@@ -41,6 +41,10 @@ const markUpdate = ({ fiber }) => {
4141
...fiber.memoizedProps,
4242
};
4343
}
44+
45+
if (fiber.stateNode) {
46+
updateInstance(fiber.stateNode);
47+
}
4448
};
4549

4650
export const cleanupReact = () => {

src/reconciler/componentComparator.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const compareComponents = (oldType, newType, setNewType, baseType) => {
3737
if (oldType.type === newType.type || areSwappable(oldType.type, newType.type)) {
3838
if (baseType) {
3939
// memo form different fibers, why?
40-
if (oldType === baseType) {
40+
if (baseType.$$typeof === newType.$$typeof) {
4141
setNewType(newType);
4242
} else {
4343
setNewType(newType.type);

0 commit comments

Comments
 (0)