mirror of
https://github.com/enso-org/enso.git
synced 2024-12-24 01:51:31 +03:00
Fix FRP events that deactivate visualizations. (#6638)
Addresses the issue described here: https://github.com/enso-org/enso/issues/6561#issuecomment-1536205322 . This was caused by FRP events that would re-set the visualization path when ending the node editing. This would eventually clear the visualization before setting it again, losing the already received data. https://github.com/enso-org/enso/assets/1428930/6e324ddf-f365-48b8-bb2a-c68b2fbd24ef also addresses the issue described here https://github.com/enso-org/enso/issues/6561#issuecomment-1543856257 https://github.com/enso-org/enso/assets/1428930/437f7822-7c35-48ba-a055-59d6f712a813 Note that now the default visualization is already shown on the first hover of the action bar, where before it was empty. This was caused by a faulty initialization.
This commit is contained in:
parent
f38033b037
commit
3e739a76c2
@ -543,7 +543,8 @@ impl Container {
|
||||
default_visualisation <- visualisation_uninitialised.on_true().map(|_| {
|
||||
Some(visualization::Registry::default_visualisation())
|
||||
});
|
||||
vis_input_type <- frp.set_vis_input_type.gate(&visualisation_uninitialised).unwrap();
|
||||
vis_input_type <- frp.set_vis_input_type.on_change();
|
||||
vis_input_type <- vis_input_type.gate(&visualisation_uninitialised).unwrap();
|
||||
default_visualisation_for_type <- vis_input_type.map(f!((tp) {
|
||||
registry.default_visualization_for_type(tp)
|
||||
}));
|
||||
|
@ -117,9 +117,15 @@ impl VisualizationChooser {
|
||||
eval_ frp.hide_selection_menu ( menu.hide_selection_menu.emit(()) );
|
||||
eval frp.set_menu_offset_y ((offset) menu.set_menu_offset_y.emit(offset) );
|
||||
|
||||
set_selected_ix <= all_with(&frp.input.set_selected, &frp.output.entries, |selected,entries|
|
||||
selected.as_ref().map(|s| entries.iter().position(|item| item == s))
|
||||
);
|
||||
set_selected_ix <= all_with(&frp.input.set_selected, &frp.output.entries, |selected,entries|{
|
||||
let selected_ix = selected.as_ref().map(|s|
|
||||
entries.iter().position(|item| item == s)
|
||||
);
|
||||
if selected.is_some() && selected_ix.is_none() {
|
||||
warn!("Invalid visualisation selected {selected:?} from available {entries:?}");
|
||||
};
|
||||
selected_ix
|
||||
});
|
||||
eval set_selected_ix ((ix) menu.set_selected.emit(ix));
|
||||
|
||||
|
||||
@ -145,20 +151,12 @@ impl VisualizationChooser {
|
||||
analytics::remote_log_value(event,field,data);
|
||||
}
|
||||
});
|
||||
input_type_changed <- frp.set_vis_input_type.on_change();
|
||||
frp.source.vis_input_type <+ frp.set_vis_input_type;
|
||||
|
||||
|
||||
// === Showing Entries ===
|
||||
|
||||
menu_appears <- menu.menu_visible.gate(&menu.menu_visible).constant(());
|
||||
|
||||
// We want to update entries according to the input type, but only when it changed and
|
||||
// menu is visible.
|
||||
input_type_when_visible <- frp.set_vis_input_type.gate(&menu.menu_visible);
|
||||
input_type_when_appeared <- frp.set_vis_input_type.sample(&menu_appears);
|
||||
input_type <- any(input_type_when_visible,input_type_when_appeared);
|
||||
input_type_changed <- input_type.on_change();
|
||||
|
||||
frp.source.entries <+ input_type_changed.map(f!([model] (input_type){
|
||||
let entries = Rc::new(model.entries(input_type));
|
||||
let provider = list_view::entry::AnyModelProvider::from(entries.clone_ref());
|
||||
|
Loading…
Reference in New Issue
Block a user