leptos icon indicating copy to clipboard operation
leptos copied to clipboard

Add Trigger::dispose

Open luxalpa opened this issue 10 months ago • 0 comments

Is your feature request related to a problem? Please describe. I currently use RwSignal<()> as a trigger because it allows me to dispose it manually. I don't see a reason why we wouldn't want to have that same functionality on Triggers.

Describe the solution you'd like

impl<T> SignalDispose for Trigger {
    fn dispose(self) {
        _ = with_runtime(|runtime| runtime.dispose_node(self.id));
    }
}

Describe alternatives you've considered Currently I'm using RwSignal<()>. To be fair I am not sure if there's any actual advantages of using Trigger over RwSignal<()>

Additional context I'm using this to implement my global state in some kind of subscriber-system where signals are being created ad-hoc only for the elements that are visible on the page instead of for the entirety of the global state (which can have a large number of objects).

luxalpa avatar Apr 22 '24 08:04 luxalpa