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

update() doesn't update the output #622

Closed
timhonders opened this issue Oct 7, 2016 · 3 comments
Closed

update() doesn't update the output #622

timhonders opened this issue Oct 7, 2016 · 3 comments

Comments

@timhonders
Copy link

It seems the update function doesn't update, it only outputs the already rendered output.

I use enzyme-to-json to do a "toMatchSnapshot", but when i change the state or simulate an event the snapshot stays the same even when i run component.update();

What i found out is:
In ShallowWrapper.js on line 164 het update function only requests the rendered output
_this2.node = _this2.renderer.getRenderOutput();

when i add
_this2.renderer.render(_this2.node, _this2.options);

It works fine

@brunoccc
Copy link

+1

@dzek69
Copy link

dzek69 commented Nov 24, 2016

I'm experiencing the same issue.

Even example from documentation doesn't work.

Edit: workaround:

const component = shallow(...);
component.instance().forceUpdate();

@ljharb
Copy link
Member

ljharb commented Aug 31, 2018

@timhonders @dzek69 can either of you provide full repro code?

The line you're referring to seems to be changed in v3, so this might be resolved. I'm going to close it, but will reopen if there's a way to repro.

@ljharb ljharb closed this as completed Aug 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants