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

Fix title synchronization in PerspectiveWidget #2355

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions packages/perspective-jupyterlab/src/js/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ export class PerspectiveView extends DOMWidgetView {
this.model.on("change:plugin_config", this.plugin_config_changed, this);
this.model.on("change:theme", this.theme_changed, this);
this.model.on("change:settings", this.settings_changed, this);
this.model.on("change:title", this.title_changed, this);

/**
* Request a table from the manager. If a table has been loaded, proxy
Expand Down Expand Up @@ -500,10 +499,4 @@ export class PerspectiveView extends DOMWidgetView {
settings: this.model.get("settings"),
});
}

title_changed() {
this.luminoWidget.restore({
title: this.model.get("title"),
});
}
}
8 changes: 7 additions & 1 deletion rust/perspective-viewer/src/rust/custom_events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ use crate::*;
/// on `CustomElements`, but when it is `drop()` the Custom Element will no
/// longer dispatch events such as `"perspective-config-change"`.
#[derive(Clone)]
pub struct CustomEvents(Rc<(CustomEventsDataRc, [Subscription; 4])>);
pub struct CustomEvents(Rc<(CustomEventsDataRc, [Subscription; 5])>);

#[derive(Clone)]
struct CustomEventsDataRc(Rc<CustomEventsData>);
Expand Down Expand Up @@ -69,6 +69,11 @@ impl CustomEvents {
last_dispatched: Default::default(),
}));

let title_sub = presentation.title_changed.add_listener({
clone!(data);
move |_| data.clone().dispatch_config_update()
});

let theme_sub = presentation.theme_config_updated.add_listener({
clone!(data);
move |_| data.clone().dispatch_config_update()
Expand Down Expand Up @@ -98,6 +103,7 @@ impl CustomEvents {
});

Self(Rc::new((data, [
title_sub,
theme_sub,
settings_sub,
plugin_sub,
Expand Down
Loading