Skip to content

Fix autocomplete popup - #3#11224

Merged
aparajit-pratap merged 6 commits intoDynamoDS:masterfrom
aparajit-pratap:fixAutocompletePopup
Nov 3, 2020
Merged

Fix autocomplete popup - #3#11224
aparajit-pratap merged 6 commits intoDynamoDS:masterfrom
aparajit-pratap:fixAutocompletePopup

Conversation

@aparajit-pratap
Copy link
Contributor

@aparajit-pratap aparajit-pratap commented Nov 2, 2020

Purpose

Attempt at fixing autocomplete popup placement one final time. Based on discussion with @zeusongit we decided that the CustomPopupPlacementCallback approach seemed most promising that would work on most machines. This also fixes an existing issue where the autocomplete popup doesn't show up on opening a new workspace.

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

@aparajit-pratap aparajit-pratap changed the title Fix autocomplete popup - part 3 Fix autocomplete popup - #3 Nov 2, 2020
@aparajit-pratap
Copy link
Contributor Author

I will also take a look at the test failure.

ViewModel.NodeAutoCompleteSearchViewModel.PortViewModel.SetupNodeAutocompleteWindowPlacement(popup);
}
popup.IsOpen = displayPopup;
popup.CustomPopupPlacementCallback = null;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this a must have or just sanity cleanup?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, otherwise the CustomPopupPlacementCallback continues pointing to PlaceAutocompletePopup, which can be invoked unexpectedly, say when in-canvas search popup is opened.

@QilongTang
Copy link
Contributor

Changes here looks good to me, but we should fix the analytics somehow and make sure we unify the implementation between incanvas search and node autocomplete. @aparajit-pratap @zeusongit

@aparajit-pratap
Copy link
Contributor Author

Can we leave this on the control level? I think it may live better there which in canvas control may just follow same example.

Where exactly would you suggest moving this to?

@QilongTang
Copy link
Contributor

Can we leave this on the control level? I think it may live better there which in canvas control may just follow same example.

Where exactly would you suggest moving this to?

https://github.com/DynamoDS/Dynamo/blob/master/src/DynamoCoreWpf/Controls/NodeAutoCompleteSearchControl.xaml.cs#L136

@aparajit-pratap aparajit-pratap merged commit 905d976 into DynamoDS:master Nov 3, 2020
@aparajit-pratap aparajit-pratap deleted the fixAutocompletePopup branch November 3, 2020 02:53
aparajit-pratap added a commit to aparajit-pratap/Dynamo that referenced this pull request Nov 3, 2020
* fix autocomplete popup - part 3

* revert unchanged file

* fix failing test, fix analytics for node autocomplete

* add null check

* review comments
@QilongTang
Copy link
Contributor

@aparajit-pratap Didn't you say the loaded function is not always called? Then why bring that implementation back?

@aparajit-pratap
Copy link
Contributor Author

aparajit-pratap commented Nov 3, 2020

@aparajit-pratap Didn't you say the loaded function is not always called? Then why bring that implementation back?

I'm not sure - it seems like it's now being invoked because the popup does appear every time after moving the placement from the loaded function to explicitly calling it here. If however, I move the call to place the popup back into the loaded function, it will not be called every time.

@QilongTang
Copy link
Contributor

QilongTang commented Nov 3, 2020

@aparajit-pratap Regardless of that, the current implementation for analytics looks wrong in this PR because the if check below can't be removed for the analytics call, otherwise initialization of the control will also trigger analytics which gives us an extra use of node autocomplete everytime user launches Dynamo. Please add it back and to the cherry-pick PR. Thanks

if (ViewModel != null && ViewModel.PortViewModel != null)

@aparajit-pratap
Copy link
Contributor Author

@QilongTang the above condition will always be true in the new case.

@QilongTang
Copy link
Contributor

@QilongTang the above condition will always be true in the new case.

Must be I was debugging the old version, but anyway this brings a bug that extra use is reported from analytics..

@aparajit-pratap
Copy link
Contributor Author

aparajit-pratap commented Nov 3, 2020

My debugging indicates that the loaded callback is being called just once for every port click and at all times both ViewModel and ViewModel.PortViewModel are non-null so if you're still seeing extra uses of analytics being reported, then even if I add the null-check, it might not fix the extra reporting. This could mean that I need to try adding the analytics tracking at some other place.
I think you're right. There is an extra call to this method; at least one when Dynamo is launched. I will add back the checks.

@QilongTang
Copy link
Contributor

My debugging indicates that the loaded callback is being called just once for every port click and at all times both ViewModel and ViewModel.PortViewModel are non-null so if you're still seeing extra uses of analytics being reported, then even if I add the null-check, it might not fix the extra reporting. This could mean that I need to try adding the analytics tracking at some other place.

The loaded function is always called for me when Dynamo is started, see below gif
NodeAutoCompleteInitialization

I think that is why I was say earlier that let's move the tracking to https://github.com/DynamoDS/Dynamo/blob/master/src/DynamoCoreWpf/Controls/NodeAutoCompleteSearchControl.xaml.cs#L136 because visibility change is a safer place IMHO. Let me know, if you are not comfortable doing it, I can make a PR because the change need to be done for in canvas search as well.

@aparajit-pratap
Copy link
Contributor Author

@QilongTang I'm not confident of how many times and when OnNodeAutoCompleteSearchControlVisibilityChanged is invoked. As a correction to my above statement, I'm adding back the null checks to the loaded method. Please let me know if that is acceptable.

@QilongTang
Copy link
Contributor

@QilongTang I'm not confident of how many times and when OnNodeAutoCompleteSearchControlVisibilityChanged is invoked. As a correction to my above statement, I'm adding back the null checks to the loaded method. Please let me know if that is acceptable.

From my debugging, that is acceptable
image

}
}

internal double ActualHeight { get; set; }
Copy link
Member

Choose a reason for hiding this comment

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

Just curious, can you explain why these were needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These were needed to get the exact height and width from the node view and exposed to the portviewmodel via the nodeviewmodel. The width and height are needed to compute the popup placement positioning.

aparajit-pratap added a commit that referenced this pull request Nov 3, 2020
* Fix autocomplete popup - #3 (#11224)

* fix autocomplete popup - part 3

* revert unchanged file

* fix failing test, fix analytics for node autocomplete

* add null check

* review comments

* add null checks
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.

4 participants