You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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
(orwaitUntil
) inside awithSelector
, 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 becomesnull
, but also never becomes equal to itself for some reason. I did not investigate further at the time, and chose to abandon the effort.The text was updated successfully, but these errors were encountered: