-
-
Notifications
You must be signed in to change notification settings - Fork 297
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
[LiveComponent] Re-initialize upon visibility #1847
Comments
I don't think we want it in the core but this is a great think you can still share your code here! 😁 |
@WebMamba |
You can look how i did it for the icon modals on this page: https://ux.symfony.com/icons I agree with you this is a frequent pattern, but ... the implementation is really different from a project to another.. so maybe we should write a short post in the cookbook ? |
@smnandre Thanks, I will have look. Adding it to the cookbook would be great. |
@smnandre just checked the repo, your implementation is slightly different from mine. Your trigger is the Click + Change event. I have added a create and edit (with livearg id) method in the live component, which is called from the records in the overview. When editing, the entity is fetched and populates the form. When creating, resetForm is called. The modal is shown using dispatchBrowserEvent. |
@smnandre I end up using a single turbo-frame in my base-template. Using a Stimulus-controller I can change the src-attribute, |
Hi,
Right now we're using a lazy Live Component in a modal, which gets initialized when the modal becomes visible; that's working great. I was wondering if it's possible to 're-initialize' a Live Component when become visible again, so not only the first time.
I only managed by adding a custom Stimulus controller that communicates with the Live Component by calling a 'init'-method.
Thanks in advance.
The text was updated successfully, but these errors were encountered: