-
-
Notifications
You must be signed in to change notification settings - Fork 330
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] delete component from DOM #2007
Comments
It's not possible afaik today, but this is a great feature idea! Would you like to work on it ? |
Oh yes, I'm excited. |
Ok, I found it in your code. |
That's the key aspect of this i guess... is just a "204" header enough ? I'm not sure... Probably it would be safer to add some header no ? |
We agree to say that is an entire component that you want to remove and not just an item inside your component? If so I think we can have a custom header that gives the ID of the component that should be removed from the DOM (UX-LIVE_COMPONENT-REMOVE='ddjf13224?D?D'). I think this could be a good candidate for a new plugin. We need to give a good way to easily create CSS transition. And what do you think instead of returning a 404, having an attribute #[Descruct], so user don't need to know about all the headers details. #[Desctruct]
public function delete(
) {
$repo = $this->repositpry->delete($this->item);
$this->item = null;
return new Response(null, 204);
} And it can be useful to trigger an event onDescrut WDYT ? |
Yes, this sounds good. Can you give me short intro where I can find some similar in library where I can inspirate? |
Maybe you can take inspiration on the loading features: |
I suggest we split this in two PR: first let's handle the delete / header / response things |
If I understand it correctly, Can I try do it like this? |
I think it would probably be easier to do directly where we handle redirections for instance... and then have a plugin to handle animation/etc. Because if the content is not returned by the response this would generate an error today |
Hi, I want delete component on ajax and remove element from DOM.
It is possible?
Some like this:
But when I do this, black backdrop is showing.
The text was updated successfully, but these errors were encountered: