-
-
Notifications
You must be signed in to change notification settings - Fork 530
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
TreeView: SelectedNodeChanged
-Event is fired when there should be no change
#4413
Comments
Maybe the same like #2380 (but it depends on the implementation of the custom |
@stsrki did you fix this on your Tree View Changes PR? |
I have tested @WolfgangKluge in the new version, and the new TreeView changes work. That is, it shows only one dialog. I assume that is what is needed? One thing that still doesn't work is when the user clicks on |
@WolfgangKluge any chance you could clone the repository and test the fixes in the |
Describe the bug
I have a TreeView and whenever the user want's to change the current node, I want to ask the user before taking any action.
To Reproduce
Here is a simple example
Whenever you click on any other node than the selected, a message pops up.
I expect the message shown states something like
Navigate from A to B?
and if you debug that, there is really such a message - but right after the first message, there's a second one statingNavigate from A to A?
. At the end nothing happens.If you use
SelectedNodeChangedSwitchBack
, the behavior is somewhat different and it seems to work - but then you get two messages in a row.I think, the main reason for the whole problem is, that you invoke
SelectedNodeChanged
wheneverSelectedNode
is changed - even if that change comes from outside.Blazorise/Source/Extensions/Blazorise.TreeView/TreeView.razor.cs
Lines 77 to 92 in 019c580
SelectedNodeChanged.InvokeAsync( state.SelectedNode );
If I move that logic (except
DirtyClasses
) toSelectNode
I get the expected behavior.Expected behavior
I expect to change
selectedNode
without gettingSelectedNodeChanged
fired.You should only fire events, if you are changing the values (not when the value is changed from outside your component).
InvokeAsync
inside the property setter of[Parameters]
seems no good idea (for all components, not only the TreeView).dotnet/aspnetcore#26230
Additional context
My workaround is to test, if the
newSelectedNode
is changed at all - but this seems unexpected and unnecessary.The text was updated successfully, but these errors were encountered: