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: setContext doesn't trigger componentWillReceiveProps #2476

Merged
merged 1 commit into from
Dec 10, 2020

Conversation

mul53
Copy link
Contributor

@mul53 mul53 commented Nov 24, 2020

Fixes #2258

Below are two code sandboxes that show the bug exists, i added enzyme to the sandbox when you run the tests sandbox 2 doesn't call the method while sandbox 1 does.

@mul53
Copy link
Contributor Author

mul53 commented Nov 24, 2020

@ljharb Here are the sandboxes

React 0.14 Sandbox
React 15 Sandbox
React 16.2 Sandbox
React 16.3 Sandbox
React 16.4 Sandbox

I will continue looking at the issue

@codecov
Copy link

codecov bot commented Nov 24, 2020

Codecov Report

Merging #2476 (76e0109) into master (2dbc816) will increase coverage by 0.07%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2476      +/-   ##
==========================================
+ Coverage   96.05%   96.13%   +0.07%     
==========================================
  Files          49       49              
  Lines        3925     4006      +81     
  Branches     1102     1123      +21     
==========================================
+ Hits         3770     3851      +81     
  Misses        155      155              
Impacted Files Coverage Δ
...nzyme-adapter-react-14/src/ReactFourteenAdapter.js 96.45% <100.00%> (+0.55%) ⬆️
...e-adapter-react-16.1/src/ReactSixteenOneAdapter.js 94.86% <100.00%> (+0.34%) ⬆️
...e-adapter-react-16.2/src/ReactSixteenTwoAdapter.js 94.88% <100.00%> (+0.32%) ⬆️
...adapter-react-16.3/src/ReactSixteenThreeAdapter.js 95.25% <100.00%> (+0.27%) ⬆️
...enzyme-adapter-react-16/src/ReactSixteenAdapter.js 95.32% <100.00%> (+0.16%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2dbc816...34828de. Read the comment docs.

Comment on lines +26 to 27
spyMethod,
} from 'enzyme-adapter-utils';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ended up adding spyMethod/spyProperty to enzyme-adapter-utils, so that the adapters didn't have to suddenly start requiring enzyme v3.4.0.

@ljharb ljharb merged commit 34828de into enzymejs:master Dec 10, 2020
@ljharb ljharb deleted the bugfix/cwrp branch December 10, 2020 18:18
ljharb added a commit that referenced this pull request Jan 20, 2021
 - [fix] add missing `enzyme-shallow-equal` (#2476)
 - [meta] babel: set `transformRuntime` to false
 - [deps] update `object.assign`, `object.values`, `react-is`, `enzyme-adapter-utils`
 - [dev deps] update `eslint`, `eslint-config-airbnb`, `eslint-config-airbnb-base`, `eslint-plugin-import`, `eslint-plugin-jsx-a11y`, `eslint-plugin-react`, `eslint-plugin-react-hooks`, `babel-plugin-add-module-exports`, `@babel/cli`, `@babel/core`, `@babel/node`, `@babel/register`, `babel-loader`
ljharb added a commit that referenced this pull request Jan 20, 2021
 - [fix] `.setContext()`: calls cWRP (#2476)
 - [deps] update `object.assign`, `object.values`, `react-is`, `enzyme-adapter-utils`
 - [dev deps] update `eslint`, `eslint-config-airbnb`, `eslint-config-airbnb-base`, `eslint-plugin-import`, `eslint-plugin-jsx-a11y`, `eslint-plugin-react`, `eslint-plugin-react-hooks`, `babel-plugin-add-module-exports`, `@babel/cli`, `@babel/core`, `@babel/node`, `@babel/register`, `babel-loader`
ljharb added a commit that referenced this pull request Jan 20, 2021
 - [fix] `.setContext()`: calls cWRP (#2476)
 - [deps] update `object.assign`, `object.values`, `enzyme-adapter-utils`
 - [dev deps] update `eslint`, `eslint-config-airbnb`, `eslint-config-airbnb-base`, `eslint-plugin-import`, `eslint-plugin-jsx-a11y`, `eslint-plugin-react`, `eslint-plugin-react-hooks`, `babel-plugin-add-module-exports`, `@babel/cli`, `@babel/core`, `@babel/node`, `@babel/register`, `babel-loader`
ljharb added a commit that referenced this pull request Jan 20, 2021
 - [fix] `.setContext()`: calls cWRP (#2476)
 - [fix] Ensure recursive calls to `displayNameOfNode` uses the adapter's version of the method (#2482)
 - [deps] update `object.assign`, `object.values`, `enzyme-adapter-utils`
 - [dev deps] update `eslint`, `eslint-config-airbnb`, `eslint-config-airbnb-base`, `eslint-plugin-import`, `eslint-plugin-jsx-a11y`, `eslint-plugin-react`, `eslint-plugin-react-hooks`, `babel-plugin-add-module-exports`, `@babel/cli`, `@babel/core`, `@babel/node`, `@babel/register`, `babel-loader`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

setContext doesn't trigger componentWillReceiveProps
2 participants