You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I'm loading a WASM package into a a react app, it's using egui to render the plot and rust to do logic.
when calling wasmHandle.start(...)
it adds the text agent with
super::text_agent::install_text_agent(self)?;
but when calling
wasmHandle.destroy()
the text_agent is not removed from the dom,
This is creating an issue if the wasmHandle.start(...) is called again.
my use case is that when someone logs out the wasmHandle is destroyed, and if they log back in again then .start is called.
i'm handling this by removing the egui_text_agent when the user logs out, but it'd be better i think if it was part of the destroy method.
I'm thinking to add
pub fn remove_text_agent() -> Result<(), JsValue> {
if let Some(element) = web_sys::window()
.unwrap()
.document()
.unwrap()
.get_element_by_id(AGENT_ID)
{
if let Some(parent) = element.patent_node() {
patent.remove_child(&element)?;
}
};
Ok(());
}
to the text_agent.rs
and then modifying webRunner destroy with a call to remove_text_agent()
pub fn destroy(&self) {
self.unsubscribe_from_all_events();
super::text_agent::remove_text_agent()?;
if let Some(runner) = self.runner.replace(None) {
runner.destroy();
}
}
Happy to make a PR if you think the above is the correct approach?
The text was updated successfully, but these errors were encountered:
Describe the bug
I'm loading a WASM package into a a react app, it's using egui to render the plot and rust to do logic.
when calling wasmHandle.start(...)
it adds the text agent with
super::text_agent::install_text_agent(self)?;
but when calling
wasmHandle.destroy()
the text_agent is not removed from the dom,
This is creating an issue if the wasmHandle.start(...) is called again.
my use case is that when someone logs out the wasmHandle is destroyed, and if they log back in again then .start is called.
i'm handling this by removing the egui_text_agent when the user logs out, but it'd be better i think if it was part of the destroy method.
I'm thinking to add
to the text_agent.rs
and then modifying webRunner destroy with a call to remove_text_agent()
Happy to make a PR if you think the above is the correct approach?
The text was updated successfully, but these errors were encountered: