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 FRP events that deactivate visualizations. #6638

Conversation

MichaelMauderer
Copy link
Contributor

@MichaelMauderer MichaelMauderer commented May 10, 2023

Pull Request Description

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.

Peek.2023-05-10.15-57.mp4

also addresses the issue described here #6561 (comment)

Peek.2023-05-11.15-35.mp4

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.

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • The documentation has been updated, if necessary.
  • Screenshots/screencasts have been attached, if there are any visual changes. For interactive or animated visual changes, a screencast is preferred.
  • All code follows the
    Scala,
    Java,
    and
    Rust
    style guides. In case you are using a language not listed above, follow the Rust style guide.
  • All code has been tested:
    • Unit tests have been written where possible.
    • If GUI codebase was changed, the GUI was tested when built using ./run ide build.

@MichaelMauderer MichaelMauderer self-assigned this May 10, 2023
@MichaelMauderer MichaelMauderer added the CI: No changelog needed Do not require a changelog entry for this PR. label May 10, 2023
@MichaelMauderer MichaelMauderer marked this pull request as ready for review May 10, 2023 15:05
@MichaelMauderer MichaelMauderer changed the title Fix spurious FRP event that deactivated visualisation. Fix FRP events that deactivate visualizations. May 11, 2023
@sylwiabr
Copy link
Member

@wdanilo @kazcw @farmaazon please review the PR

Comment on lines +519 to +520
vis_input_type <- frp.set_vis_input_type.on_change();
vis_input_type <- vis_input_type.gate(&visualisation_uninitialised).unwrap();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this on_change is needed? Wouldn't it be stopped on the on_change in visualization_path later anyway?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is, that it updates the visualization chooser, which in turn sends an update that nothing was selected, causing the visualization to be set to None.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is, that it updates the visualization chooser, which in turn sends an update that nothing was selected, causing the visualization to be set to None.

Please add this useful info as a comment here.

Comment on lines -153 to -161
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();

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this is deleted?

I'm afraid that on scenes with really many nodes we cannot afford to go through every visualization and update all chooser which are invisible anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough, but this code was essentially wrong. What happened here was, that the list of entries was only ever updated when the visualization chooser had an open selection menu. That means that the preview was never updated unless the menu was opened, and the internal state was somewhat inconsistent.

If we want the performance benefit of not updating the menu unless shown, we need to do it in the action bar, where we have the actual information about whether the visualization chooser is visible.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's go with it for now, but I'm very confused here. I wouldn't expect that updating or not the list in the view would have an effect on how the visualization updates work. Certainly we need to do some refactoring here.

Comment on lines +519 to +520
vis_input_type <- frp.set_vis_input_type.on_change();
vis_input_type <- vis_input_type.gate(&visualisation_uninitialised).unwrap();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is, that it updates the visualization chooser, which in turn sends an update that nothing was selected, causing the visualization to be set to None.

Please add this useful info as a comment here.

Comment on lines -153 to -161
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();

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's go with it for now, but I'm very confused here. I wouldn't expect that updating or not the list in the view would have an effect on how the visualization updates work. Certainly we need to do some refactoring here.

@farmaazon
Copy link
Contributor

QA report: 🍏

No issue spotted which is not on develop.

@MichaelMauderer MichaelMauderer added the CI: Ready to merge This PR is eligible for automatic merge label May 16, 2023
@mergify mergify bot merged commit 3e739a7 into develop May 16, 2023
@mergify mergify bot deleted the visualizations_updates_are_not_stable_and_leaving_visualizations_blank branch May 16, 2023 15:51
mergify bot pushed a commit that referenced this pull request May 26, 2023
Re-introduce a feature that was removed with #6638: only initialize visualization choosers when they are visible. This avoids initializing lots of invisible UI elements at the same time when opening a project.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: No changelog needed Do not require a changelog entry for this PR. CI: Ready to merge This PR is eligible for automatic merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants