Skip to content

Commit afa8ed4

Browse files
committed
fix: do not update hooks while updating hooks, fixes #1294
1 parent b0ee8db commit afa8ed4

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

Diff for: src/proxy/createClassProxy.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -341,13 +341,13 @@ function createClassProxy(InitialComponent, proxyKey, options = {}) {
341341
}
342342

343343
if (NextComponent === CurrentComponent) {
344-
return;
344+
return false;
345345
}
346346

347347
// Prevent proxy cycles
348348
const existingProxy = proxies.get(NextComponent);
349349
if (existingProxy) {
350-
return;
350+
return false;
351351
}
352352

353353
isFunctionalComponent = !isReactClass(NextComponent);
@@ -412,6 +412,8 @@ function createClassProxy(InitialComponent, proxyKey, options = {}) {
412412
classUpdatePostponed = classHotReplacement;
413413
}
414414
}
415+
416+
return true;
415417
}
416418

417419
update(InitialComponent);

Diff for: src/reconciler/proxies.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@ export const updateProxyById = (id, type, options = {}) => {
5757
id,
5858
merge({}, renderOptions, { proxy: componentOptions.get(type) || {} }, options),
5959
);
60-
} else {
61-
proxiesByID[id].update(type);
60+
} else if (proxiesByID[id].update(type)) {
6261
// proxy could be registered again only in case of HMR
6362
incrementHotGeneration();
6463
}

0 commit comments

Comments
 (0)