-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
chore: fallback to looking in props for the slot block #13652
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
Conversation
|
I mean this is already possible right? |
|
I fear this will result in false positives, since it's possible to have a prop and slot with the same name. I'd rather make it a convention that dashes are converted to underscores during the migration |
But then we can't really migrate those slots because we might not migrate the receiving component. I think it's fine too, we can just error and output the migrate task |
| var possible_snippet = $$props[name]; | ||
| if ( | ||
| typeof possible_snippet === 'function' && | ||
| (!DEV || validated_snippets.has(possible_snippet)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That feels brittle to me - it means things work subtly different in prod, which could break things.
We can. What I mean is, instead of just always checking for a prop, we convert dashes to underscores before checking This PR needs a test btw. |
Ohhh gotcha...i'll work on the rest of the stuff for the migration while we make a decision on this. |
|
Yeah I think it's fine to go a different direction, I'll close this PR. |
This should allow the pattern I mention in this comment:
#13649
I also added a layer of protection and validation in DEV to ensure people don't try and pass in arbitrary functions pretending to be snippets.
I think this would be impactful for migration but might have other benefits too. @dummdidumm does this check out to you?