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

Sveltosis - cannot provide props using $$props (or $$restProps) #1247

Open
2 of 12 tasks
megan-starr9 opened this issue Jul 28, 2023 · 0 comments
Open
2 of 12 tasks

Sveltosis - cannot provide props using $$props (or $$restProps) #1247

megan-starr9 opened this issue Jul 28, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@megan-starr9
Copy link

I am interested in helping provide a fix!

Yes

Which generators are impacted?

  • All
  • Angular
  • HTML
  • Preact
  • Qwik
  • React
  • React-Native
  • Solid
  • Stencil
  • Svelte
  • Vue
  • Web components

Reproduction case

https://mitosis.builder.io/?outputTab=E4UwhgxgLkA%3D&inputTab=M4NwpgNgLmQ%3D&code=DwZwxgTglgDgLgAgDYEMB2BzAvAIjiHAPgCgEEBTADxgHsJElzEwak6EsEByLgbmOAB6cNHgkBAIwCucODTSkEAbwB0agCTqI5EHAAKEGjBABfRao3qYh42bIpoKALQALKABN35NFiWbrRiAA2lwOUM5unt5cALp2CPIAXGBIUGAA1sQkZKBscIQAwqkZCC7k2kIgeSRC0rLyJEA

Expected Behaviour

For the bug portion, I would expect $$props['some-input'] in Svelte to be translated into props['some-input'] in React.

Ideally, there would also be a way to provide destructured props to child elements. When working with wrappers for dom elements, it's a hugely bad use case to need to specify every dom attribute that might be used (especially in the case of UI libraries).

Minimally, it would be nice if {...$$props} would translate to {...props}. Redundant, or unwanted, props could then be overridden with more specific behavior. The ideal long-term would be to allow for destructured use of $$restProps but I know that's a bigger ask, since props aren't destructured at all within the generated code

Actual Behaviour

In React specifically, $$props['some-input'] is not converted and is provided as $$props['some-input'] to the child.

Across all generators, {...$$props} and {...$$restProps} are removed entirely from the response.

Additional Information

No response

@megan-starr9 megan-starr9 added the bug Something isn't working label Jul 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant