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

Destroy method replaces original elements #737

Open
michaljerabek opened this issue Oct 29, 2024 · 2 comments
Open

Destroy method replaces original elements #737

michaljerabek opened this issue Oct 29, 2024 · 2 comments
Milestone

Comments

@michaljerabek
Copy link

Hi,

since this PR, the destroy method replaces the original elements with clones. I would say that this is highly unexpected behavior and causes more issues then it solves. In my case, I need to switch between an inline component and a modal on resize, but it's pretty difficult to do, because those elements keep changing. In my opinion, this behavior shouldn't be there at all, but it would be nice if it could be at least optional.

Thanks for consideration.

@KittyGiraudel
Copy link
Owner

Hello Michal,

That’s a fair point. As the comment explains, we introduced this because we wanted to make sure that we’d clean all event listeners, even if the implementor forgot to do it themselves. It’s pretty good to ensure there is no memory leak after destroying a dialog.

I don’t know if we can safely remove that, and not without a breaking change I’d say anyway. I’m going to tag it for v9 for triage purposes. :)

@KittyGiraudel KittyGiraudel added this to the Version 9 milestone Oct 29, 2024
@michaljerabek
Copy link
Author

Ok, thanks, Is there any chance it could be updated in the current version with some function parameter? Something like:

function destroy(iPromiseIWillClearAllEventHandlersMyself: boolean) {
    if (iPromiseIWillClearAllEventHandlersMyself !== true) {
        // replace...
    }
}

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