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
Problem
When the props of a parcel are updated (using the update lifecycle function) the entire react tree inside the parcel is recreated from scratch. This means that all internal state is reset.
It seems that the problem is introduced by the fix for the parcels props not updating in #126 (v4.4)
Reproduction steps
Below is a little codesandbox that demonstrates the issue by having two independent counters. One that is incremented in the containing react app plus a second counter that is incremented inside the parcel.
In v4.1 both counters continue to increment as expected.
In v4.2-4.3 the container's counter isn't injected properly into the parcel
In v.4.4 and later the parcel-internal counter is reset to its start value whenever the parcel props are updated
Hey @joeldenning. Don't know if you or another maintainer of this repo had time to look at this. But to me this looks like a pretty serious issue. If I understood the api's correctly a component rendering a Parcel that is using single-spa-react to wrap the life-cycle methods should be able to modify the Parcel's Props without re-rendering the whole React tree, re-setting the state etc etc. As @gabbaxx pointed out it worked that way in version <= 4.1
This is fixed in #138. If in a week or so I haven't merged and published, it's because I didn't get a code review and forgot about it, so feel free to ping me.
Problem
When the props of a parcel are updated (using the update lifecycle function) the entire react tree inside the parcel is recreated from scratch. This means that all internal state is reset.
It seems that the problem is introduced by the fix for the parcels props not updating in #126 (v4.4)
Reproduction steps
Below is a little codesandbox that demonstrates the issue by having two independent counters. One that is incremented in the containing react app plus a second counter that is incremented inside the parcel.
In v4.1 both counters continue to increment as expected.
In v4.2-4.3 the container's counter isn't injected properly into the parcel
In v.4.4 and later the parcel-internal counter is reset to its start value whenever the parcel props are updated
https://codesandbox.io/s/updated-parcel-props-remounts-root-component-jnle3?file=/index.html
The problem exists for both react version 17 and 18.
The text was updated successfully, but these errors were encountered: