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 should lookup parent first #7

Open
fsoikin opened this issue Dec 26, 2021 · 0 comments
Open

update should lookup parent first #7

fsoikin opened this issue Dec 26, 2021 · 0 comments

Comments

@fsoikin
Copy link
Contributor

fsoikin commented Dec 26, 2021

According to Enzyme docs, update only works on the root element, and calling it on a non-root element doesn't crash, but has no effect.

This is a bit of a hole in our API (and in Enzyme's own API as well), because once you call update (or waitUntil) inside a withSelector, it's very unobvious why the bloody thing isn't working. Caused me a 20-minute debugging session once.

To mitigate this, I think the most ergonomic way is to have the update function take care of looking up the parent on its own.

At one point I tried the naive approach of calling parent in a loop, but that doesn't quite work: the result never becomes null, but also never becomes equal to itself for some reason. I did not investigate further at the time, and chose to abandon the effort.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant