-
-
Notifications
You must be signed in to change notification settings - Fork 361
[Twig][Live] Native attributes #255
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
ce4d954
to
53ec97f
Compare
I think this PR is a good idea. |
dfdbb3a
to
2bcbc62
Compare
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.
I think this is good. It introduces MountedComponent
, but that feels ok to me. 👍 for mer personally
$metadata, | ||
array_merge(['this' => $component], get_object_vars($component)) | ||
); | ||
$event = new PreRenderEvent($mounted, $this->factory->metadataFor($mounted->getName())); |
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.
Requiring the service here is a bit unfortunate.
d79f435
to
37acff2
Compare
Thanks Kevin! |
This removes the need for the
HasAttributesTrait
that was introduced in #220. Attributes are now "a thing all component have".ComponentFactory::create()
returns a newMountedComponent
object that holds the "mounted" component, attributes and component metadata.LiveComponentHydrator::dehydrate()
now accepts an instance ofMountedComponent
andLiveComponentHydrator::hydrate()
now returns an instance ofMountedComponent
.If the component is live, any attributes are dehydrated/hydrated as "readonly" data (they can't be modified by the frontend).
TODO
HasAttributesTrait