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

Hide All context menu in workspace when displaying node context menu #12565

Merged
merged 3 commits into from
Jan 22, 2022

Conversation

QilongTang
Copy link
Contributor

@QilongTang QilongTang commented Jan 20, 2022

Please Note:

  1. Before submitting the PR, please review How to Contribute to Dynamo
  2. Dynamo Team will meet 1x a month to review PRs found on Github (Issues will be handled separately)
  3. PRs will be reviewed from oldest to newest
  4. If a reviewed PR requires changes by the owner, the owner of the PR has 30 days to respond. If the PR has seen no activity by the next session, it will be either closed by the team or depending on its utility will be taken over by someone on the team
  5. PRs should use either Dynamo's default PR template or one of these other template options in order to be considered for review.
  6. PRs that do not have one of the Dynamo PR templates completely filled out with all declarations satisfied will not be reviewed by the Dynamo team.
  7. PRs made to the DynamoRevit repo will need to be cherry-picked into all the DynamoRevit Release branches that Dynamo supports. Contributors will be responsible for cherry-picking their reviewed commits to the other branches after a LGTM label is added to the PR.

Purpose

Per https://jira.autodesk.com/browse/DYN-4509, https://jira.autodesk.com/browse/DYN-4459 and #12532, fixing the issue that other popups are not hidden when displaying the node context menu. This fact will create all kinds of weird interactions.

  1. Hide All other popups in workspace when displaying node context menu
  2. Even if it fail, UpdateModelValueImp should not crash Dynamo. Catching the exception and logging it to Dynamo console

Declarations

Check these if you believe they are true

  • The codebase is in a better state after this PR
  • Is documented according to the standards
  • The level of testing this PR includes is appropriate
  • User facing strings, if any, are extracted into *.resx files
  • All tests pass using the self-service CI.
  • Snapshot of UI changes, if any.
  • Changes to the API follow Semantic Versioning and are documented in the API Changes document.
  • This PR modifies some build requirements and the readme is updated

Release Notes

Hide All context menu in workspace when displaying node context menu

Reviewers

@reddyashish @zeusongit

FYIs

@johnpierson

@QilongTang QilongTang marked this pull request as ready for review January 21, 2022 16:29
}

[Test]
[Category("UnitTests")]
public void UpdateModelValue_EmptyList_ThrowsException()
{
var command = new DynCmd.UpdateModelValueCommand(Guid.Empty, new Guid[] { }, "", "");
Assert.Throws<ArgumentNullException>(() => CurrentDynamoModel.ExecuteCommand(command));
Assert.Throws<ArgumentNullException>(() => CurrentDynamoModel.CurrentWorkspace.UpdateModelValue(command.ModelGuids,
command.Name, command.Value));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@aparajit-pratap Let me know if you have a strong opinion on this. In my opinion, this should not crash Dynamo but currently, it is

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you remind me how these exceptions can be reproduced exactly? Looking at that old PR, I see that these exceptions are thrown when either the nodemodel is not found in the workspace or the list of nodemodels passed is null or empty, but how exactly can these situations be reproduced.

command.Name, command.Value);
}
catch (Exception ex)
{
Logger.LogError(ex.Message);
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we know what kinds of exceptions are these and why are they thrown?

Copy link
Contributor Author

@QilongTang QilongTang Jan 21, 2022

Choose a reason for hiding this comment

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

There is code inside the function UpdateModelValue that throw the invalid operation exception, but they are not caught anywhere. In that case, Dynamo will simply crash

{
ShowHidePopup(ShowHideFlags.Hide, PortContextMenu);
ShowHidePopup(ShowHideFlags.Hide, NodeAutoCompleteSearchBar);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

So if the sender is not the nodeview (if it's the workspace), the node level popups can still be open?

Copy link
Contributor Author

@QilongTang QilongTang Jan 21, 2022

Choose a reason for hiding this comment

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

Yes, this is the intended design from UX originally. e.g. if node autocomplete is triggered, but user clicking on canvas, the node autocomplete dialog should remain open

Copy link
Contributor

@aparajit-pratap aparajit-pratap left a comment

Choose a reason for hiding this comment

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

I think overall it's better to catch unhandled exceptions that would otherwise lead to a crash. Just one question as to steps that a user would follow in Dynamo that would lead to these crashes earlier?

@QilongTang
Copy link
Contributor Author

I think overall it's better to catch unhandled exceptions that would otherwise lead to a crash. Just one question as to steps that a user would follow in Dynamo that would lead to these crashes earlier?

Yes, @aparajit-pratap You can refer to #12532, although it should be avoided by my PR but I think catching the exception would be better than just leaving it as it is. Let me know

@QilongTang QilongTang merged commit 738ab89 into RC2.13.1_master Jan 22, 2022
@QilongTang QilongTang deleted the HideAllPopupWhenDisplayingNodeContextMenu branch January 22, 2022 18:40
QilongTang added a commit that referenced this pull request Jan 24, 2022
…12565)

* Hide All context menu in workspace when displaying node context menu

* Fix the crash for lacing menu

* fix unit tests
@QilongTang QilongTang mentioned this pull request Jan 24, 2022
8 tasks
QilongTang added a commit that referenced this pull request Jan 24, 2022
* Hide All context menu in workspace when displaying node context menu (#12565)

* Hide All context menu in workspace when displaying node context menu

* Fix the crash for lacing menu

* fix unit tests

* Update Color (#12572)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants