Skip to content

Commit

Permalink
Fix FRP events that deactivate visualizations. (#6638)
Browse files Browse the repository at this point in the history
Addresses the issue described here: #6561 (comment) .
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 #6561 (comment)


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.
  • Loading branch information
MichaelMauderer authored May 16, 2023
1 parent f38033b commit 3e739a7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));


Expand All @@ -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());
Expand Down

0 comments on commit 3e739a7

Please sign in to comment.