-
Notifications
You must be signed in to change notification settings - Fork 635
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
improve performance of bubbleINfo #15129
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -698,7 +698,11 @@ private void OnUpdateGraphCompleted(AsyncTask task) | |
var node = workspace.Nodes.FirstOrDefault(n => n.GUID == guid); | ||
if (node == null) | ||
continue; | ||
|
||
// Block Infos updates during the many errors/warnings/notifications added here | ||
// InfoBubbles will be updated on NodeViewModel's EvaluationCompleted handler. | ||
using (node.PropertyChangeManager.SetPropsToSuppress(nameof(NodeModel.Infos), nameof(NodeModel.State))) | ||
using (Disposable.Create(() => { node.BlockInfoBubbleUpdates = true; }, () => { node.BlockInfoBubbleUpdates = false; })) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I haven't refreshed my memory on the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. PropertyChangeManager handles property changes. There are still CollectionChanged events that slip through the cracks. PropertyChangeManager was never adapted to suppress CollectionChanged events (Not sure it can easily) BlockInfoBubbleUpdates is required for now to block UpdateBubbleContent calls during collection changed events. There is an event in the NodeViewModel class, |
||
{ | ||
node.Warning(warning.Value); // Update node warning message. | ||
} | ||
|
@@ -711,7 +715,11 @@ private void OnUpdateGraphCompleted(AsyncTask task) | |
var node = workspace.Nodes.FirstOrDefault(n => n.GUID == guid); | ||
if (node == null) | ||
continue; | ||
|
||
// Block Infos updates during the many errors/warnings/notifications added here | ||
// InfoBubbles will be updated on NodeViewModel's EvaluationCompleted handler. | ||
using (node.PropertyChangeManager.SetPropsToSuppress(nameof(NodeModel.Infos), nameof(NodeModel.State))) | ||
using (Disposable.Create(() => { node.BlockInfoBubbleUpdates = true; }, () => { node.BlockInfoBubbleUpdates = false; })) | ||
{ | ||
node.Info(string.Join(Environment.NewLine, info.Value.Select(w => w.Message))); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1256,10 +1256,17 @@ private void UpdateErrorBubbleWidth() | |
/// </summary> | ||
private void BuildErrorBubble() | ||
{ | ||
if (ErrorBubble == null) ErrorBubble = new InfoBubbleViewModel(this) | ||
if (ErrorBubble == null) | ||
{ | ||
IsCollapsed = this.IsCollapsed | ||
}; | ||
ErrorBubble = new InfoBubbleViewModel(this) | ||
{ | ||
IsCollapsed = this.IsCollapsed, | ||
// The Error bubble sits above the node in ZIndex. Since pinned notes sit above | ||
// the node as well and the ErrorBubble needs to display on top of these, the | ||
// ErrorBubble's ZIndex should be the node's ZIndex + 2. | ||
ZIndex = ZIndex + 2 | ||
}; | ||
} | ||
|
||
ErrorBubble.NodeInfoToDisplay.CollectionChanged += UpdateOverlays; | ||
ErrorBubble.NodeWarningsToDisplay.CollectionChanged += UpdateOverlays; | ||
|
@@ -1273,14 +1280,8 @@ private void BuildErrorBubble() | |
WorkspaceViewModel.Errors.Add(ErrorBubble); | ||
}); | ||
} | ||
|
||
// The Error bubble sits above the node in ZIndex. Since pinned notes sit above | ||
// the node as well and the ErrorBubble needs to display on top of these, the | ||
// ErrorBubble's ZIndex should be the node's ZIndex + 2. | ||
ErrorBubble.ZIndex = ZIndex + 2; | ||
|
||
// The Node displays a count of dismissed messages, listening to that collection in the node's ErrorBubble | ||
|
||
ErrorBubble.DismissedMessages.CollectionChanged += DismissedNodeMessages_CollectionChanged; | ||
} | ||
|
||
|
@@ -1464,7 +1465,15 @@ private void DisposeErrorBubble() | |
|
||
public void UpdateBubbleContent() | ||
{ | ||
if (DynamoViewModel == null) return; | ||
if (NodeModel.BlockInfoBubbleUpdates) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can simplify this with: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I find it easier to read this way. |
||
{ | ||
return; | ||
} | ||
|
||
if (DynamoViewModel == null) | ||
{ | ||
return; | ||
} | ||
|
||
bool hasErrorOrWarning = NodeModel.IsInErrorState || NodeModel.State == ElementState.Warning; | ||
bool isNodeStateInfo = NodeModel.State == ElementState.Info || NodeModel.State == ElementState.PersistentInfo; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably could have stopped collection notifications on nodeModel.Infos, but a dedicated flag for updates to bubbleInfo seemed easier to do and understand