Skip to content

Commit

Permalink
fix: do not update hooks while updating hooks, fixes #1294
Browse files Browse the repository at this point in the history
  • Loading branch information
theKashey committed Jul 10, 2019
1 parent b0ee8db commit 867441b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/global/generation.js
Expand Up @@ -64,5 +64,9 @@ export const get = () => generation;

// These counters tracks HMR generations, and probably should be used instead of the old one
let hotReplacementGeneration = 0;
export const incrementHotGeneration = () => hotReplacementGeneration++;
export const incrementHotGeneration = () => {
if (!hotComparisonOpen()) {
hotReplacementGeneration++;
}
};
export const getHotGeneration = () => hotReplacementGeneration;
1 change: 1 addition & 0 deletions test/hot/react-dom.integration.spec.js
Expand Up @@ -119,6 +119,7 @@ describe(`🔥-dom`, () => {
ReactDom.render(<Fun1 />, el);

expect(el.innerHTML).toEqual('fun1');
configureGeneration(0, 0);
incrementHotGeneration();
{
const Fun1 = () => {
Expand Down

0 comments on commit 867441b

Please sign in to comment.