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

Error thrown when passing a decorator through two components' extra-attributes #3424

Open
Mtn-View opened this issue May 24, 2023 · 2 comments

Comments

@Mtn-View
Copy link

Mtn-View commented May 24, 2023

Description:

I use a lot of components, some are nested within each other. When I pass a decorator to my itAutocomplete component, it gets yielded to the itInput component through {{yield extra-attributes}}, then to an <input> through {{yield extra-attributes}} again. It then throws on this line because decorators is undefined.

Versions affected:

1.4.2

Platforms affected:

Ractive 1.4.2

Reproduction:

This playground will give the error I am describing. If you comment line 21 and uncomment line 22 you'll see that the error does not occur when passing a decorator through one layer of extra-attributes, as the itSelect still works.

@evs-chris
Copy link
Contributor

evs-chris commented Jun 16, 2023

Sorry, my notification for this got buried in my dumpster fire of an inbox.

This is sort of a bug related to what's allowed to be yielded from within a component tag. Normally, a decorator cannot exist as a component attribute and is always just shuffled through into the extra-attributes partial, but if you wrap it in a partial, which is perfectly valid for a component, it gets hidden until render time. A cursory glance suggests that there's not great way to catch that without a whole bunch of overhead, but there is a pretty reasonable workaround: put the extra attributes yield in another partial passed to the inner component so as not to try to render the decorator on the intermediary component.

Unfortunately, that makes your inner component no longer completely generic. I'm not entirely sure there's a workaround for that, aside from providing an empty passedAttributes partial in itInput and yielding it alongside extra-attributes.

@Mtn-View
Copy link
Author

Your workaround seems like it'd work in my use case, so I'll do some thinking over the weekend and probably give it a try next week. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants