Skip to content

Commit

Permalink
fix: disable refresh mobx observer wrapper component
Browse files Browse the repository at this point in the history
  • Loading branch information
misaeldossantos authored Sep 25, 2022
1 parent cb5084d commit f6eb19d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/react-refresh/src/ReactFreshRuntime.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,12 @@ function isReactClass(type) {
return type.prototype && type.prototype.isReactComponent;
}

function isMobxObserver(type) {
return typeof type === "function" && type.name === "observerComponent"
}

function canPreserveStateBetween(prevType, nextType) {
if (isReactClass(prevType) || isReactClass(nextType)) {
if (isReactClass(prevType) || isReactClass(nextType) || isMobxObserver(nextType)) {
return false;
}
if (haveEqualSignatures(prevType, nextType)) {
Expand Down

0 comments on commit f6eb19d

Please sign in to comment.