-
Notifications
You must be signed in to change notification settings - Fork 558
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
Bug: slots with data #1333
Comments
This is a bug. Here we generate these slots: mitosis/packages/core/src/generators/vue/blocks.ts Lines 297 to 305 in e862056
We are missing the slots' properties and bindings, which are generated by this function:
I believe you should be able to reuse that function. If not, feel free to modify it as needed |
I'm not sure how to "reuse that function", do you mean when creating a bugfix? |
Yes, I am describing the process of contributing a fix to Mitosis itself 😄 |
AH, check. I see react and svelte also aren't binding this, is this something you'd want? |
@samijaber I pulled down the repo and I immediately have failing tests: |
There might be a problem with the configuration of the repo. Do the tests pass if you run |
Yes that seems to work out fine. Additionally, I now have 22 modified files after running |
I added some editorconfig to lock the newlines on unix line endings and now tests don't create new updates. So, I'm sure that was it. I've done some digging and react seems to want you to use any kind of dynamic component like so: <p>DynamicComponent({ prop: value })</p> So I'd propose to change the slot implementation in react to something similar. <ul>
{items.map((item) => (
<li>{ slotExample({ item }) }</li>
))}
</ul> However, that would mean the regular slots will probably be better off looking like: <p>{ slotRegular() }</p> Are you okay with that? I'll focus on Let me know if you have any questions, concerns or other remarks. |
@samijaber I'm having a hard time understanding this part: It looks like that in the case of a nameless slot, when there is anything in I added some test scenarios to make it consistent. |
Hi, @samijaber I've figured some things out and made some progress but I'm kind of stuck right now. I can't find where this happens. Thanks |
These definitions are stored in the mitosis/packages/core/src/types/mitosis-component.ts Lines 148 to 149 in e862056
which is then consumed by each generator, like here:
|
If you are concerned about the |
No I'm not, I converted react slots from a field to function so data can passed just like in vue, svelte, etc. However, the type still generates |
I just looked at the snapshot you screenshotted:
It is actually an error to import the Mitosis So it is safe to ignore this type or change it to |
Ah, check. I see now. I'll continue with solid then. I may have some backwards compatibility questions when I'm done. |
@Marvin-Brouwer I just re-read your implementation suggestion and realized it could cause breaking issues for other folks. Would you mind firing up a draft PR with what you have so far, so I can see what you mean exactly and align on the implementation? This will prevent you from wasting time in a direction we don't want Mitosis to go into. |
Sure, on it! |
Here you go: #1336 |
I actually noticed that solid already has this feature. |
@samijaber |
@samijaber is there anything I can do to help move this forward? |
I need a slot in a list in which I can pass around the data of it's parent.
So for example, with a component like this:
I'd like this ouput in Vue
In vue you can do:
<slot name="page" :item={item}></slot>
, however I can't seem to figure out how to make mitosis do this.The documentation doesn't state this as a gotcha, but it also doesn't state how to do this.
If I need to make a feature request for this, please just tell me and close the ticket.
Thanks,
https://mitosis.builder.io/?outputTab=G4VwpkA%3D&code=JYWwDg9gTgLgBAbzgZQDYRgGjgGQIYCeEArlnAGLRwC%2BcAZlBCHAEQACARscKgCYCmUAHTAIAehDAYEAM7AZLANwAoZfwAekWHAF08xVPDrEAdgGMYok3ACyBAMJNIJ%2FiZgAKMIzAyAlImU4ODMIExl4DTxwVH44AF44AG04VSCgljwZXjoWTEC0ll4ZOiLslnyAXVS4KH4YYihrd3yggB5eYAA3AD4WtL62yig4fjwzAAs4hEjo%2FlpetMWApaX3KX4QfzjuuGaVldawbta0DDgTKP4prwgfIRl0GAAFPABzObh1kCmv6mOxU4wf5HAZLXygoLUUGtMRDBZpGEdHr5XwqahAA%3D%3D%3D&inputTab=FYZwHkA%3D
The text was updated successfully, but these errors were encountered: