single-spa-react icon indicating copy to clipboard operation
single-spa-react copied to clipboard

Parcel appendTo appears to be broken

Open alanquigley-toast opened this issue 2 years ago • 4 comments

When I set appendTo on a Parcel, I get a mount failure. The error leads back to the following line: https://github.com/single-spa/single-spa-react/blob/c2cf48547226484d2e30ca74b90393ae6c998b01/src/parcel.js#L49

When appendTo is set, the following React.createElement call never happens, so this.el is never set. https://github.com/single-spa/single-spa-react/blob/13e9fc86a567e94145be99b0d879e1c5fabb5e16/src/parcel.js#L104

When the call to getParcelProps function is made on line L51 the domElement is internally set to undefined, and the spread overrides the created domElement on L50 https://github.com/single-spa/single-spa-react/blob/13e9fc86a567e94145be99b0d879e1c5fabb5e16/src/parcel.js#L155

My question is, does this look like a bug, or is it related to my use-case currently. It seems like a bug.

Swapping lines L51 with L50 so that the newly generated domElement is added after the getParcelProps call does resolve the issue.

Happy to create a PR if required.

alanquigley-toast avatar Nov 23 '22 14:11 alanquigley-toast

Hi, I've encountered this issue as well, any plans on fixing it? I can also open a pr if needed.

SeverS avatar Oct 12 '23 07:10 SeverS

@alanquigley-toast @MilanKovacic sorry for pinging you but I need to decide if I proceed with a workaround or wait for a fix

SeverS avatar Oct 12 '23 13:10 SeverS

Hi, PRs are always welcome. Feel free to submit one. If possible, also set up a minimal reproduction repository.

MilanKovacic avatar Oct 14 '23 04:10 MilanKovacic

Thanks @MilanKovacic, I've opened pr #199 and also added reproduction repository in the description.

SeverS avatar Oct 14 '23 11:10 SeverS