Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix to call a setState callback after finishing the the render #1453

Merged
merged 6 commits into from
Jan 6, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use super.invokeSetStateCallback
  • Loading branch information
koba04 authored and ljharb committed Jan 6, 2018
commit d8fa20cb7135804b7372ccd7305447a69028b180
Original file line number Diff line number Diff line change
@@ -256,11 +256,11 @@ class ReactFifteenFourAdapter extends EnzymeAdapter {
}

invokeSetStateCallback(instance, callback) {
// React in <= 15.3, and >= 16 pass undefined to a setState callback
// React in >= 15.4, and < 16 pass undefined to a setState callback
if (MINOR_VERSION >= 4) {
callback.call(instance, undefined);
} else {
callback.call(instance);
super.invokeSetStateCallback(instance, callback);
}
}
}
Original file line number Diff line number Diff line change
@@ -255,7 +255,7 @@ class ReactFifteenAdapter extends EnzymeAdapter {
}

invokeSetStateCallback(instance, callback) {
// React in <= 15.3, and >= 16 pass undefined to a setState callback
// React in >= 15.4, and < 16 pass undefined to a setState callback
callback.call(instance, undefined);
}
}