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

It's not possible to mount a micro-frontend if it expects a prop named config #195

Open
fcano-ut opened this issue Oct 9, 2023 · 1 comment

Comments

@fcano-ut
Copy link

fcano-ut commented Oct 9, 2023

The way the API is thought, it expects microfrontend props to be passed at the same level than the rest of the props..

This causes this code to fail if the microfrontend props contain a prop named "config"

<Parcel
  config={microfrontend}
  wrapWith="div"
  parcelDidMount={onMicrofrontendMounted}
  {...parcelProps}
/>

Of course, these conflicts doesn't only happen with config, but also with wrapWith and all the rest of the Parcel props, but the config case is the worst because it causes the Parcel not to render at all.

It seems like a solution to this, without introducing a breaking change, would be to have a new prop named something like parcelProps... If that prop is used, the props object to pass to the microfrontend could be that one, instead of the ones at the first level. It would be optional and if nothing is passed, it could continue working as before.

<Parcel
  config={microfrontend}
  wrapWith="div"
  parcelDidMount={onMicrofrontendMounted}
  parcelProps={parcelProps}
/>

Does this make sense? I think it should be a simple enough change, I could attempt to do it myself :)
(Seems like the change is mostly on propTypes and here, and then of course the docs could need a change)

@MilanKovacic
Copy link
Contributor

Hi, thank you for submitting the proposal. To me, proposal looks valid. Codemod could also be provided to migrate users to the new approach. @joeldenning, @robmosca what do you think?

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

2 participants