Skip to content

LT-22691: Fix command routing through the hidden DataTree adapter - #1079

Merged
mark-sil merged 1 commit into
mainfrom
LT-22691
Aug 19, 2026
Merged

LT-22691: Fix command routing through the hidden DataTree adapter#1079
mark-sil merged 1 commit into
mainfrom
LT-22691

Conversation

@mark-sil

@mark-silmark-sil commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

The Avalonia detail host drives the legacy DataTree as a hidden command-routing adapter, but Mediator message-target selection dropped invisible trees and slices from the colleague chain. Every handler defined on the tree itself (JumpToTool, Delete, Insert, Move Field) and every slice-level handler (the Writing Systems options list) was unreachable, so those menu items were inert or wrongly disabled.

Keep an adapter-flagged tree and its slices in the colleague chain via IsExternalCommandAdapter, and clear the flag when the legacy view reactivates so a runtime UI flip does not widen legacy targeting.

Target the adapter's CurrentSlice by object and field name: sibling rows share one MoForm, and handlers such as GetGuidForJumpToTool resolve the target from CurrentSlice.Flid. Add
SetCurrentSliceForCommandTarget because ShowObject suspends ordinary CurrentSlice assignment until an idle callback, silently discarding the adapter's targeting, and add ClearCurrentSlice as the sanctioned no-target state. Exclude lazy placeholders via the new Slice.IsLazyPlaceholder instead of IsRealSlice, which for view-backed slices reports layout state and is false forever in a tree that is never shown.

Note: Other changes are need to complete LT-22691.


This change is Reviewable

The Avalonia detail host drives the legacy DataTree as a hidden
command-routing adapter, but Mediator message-target selection dropped
invisible trees and slices from the colleague chain. Every handler
defined on the tree itself (JumpToTool, Delete, Insert, Move Field)
and every slice-level handler (the Writing Systems options list) was
unreachable, so those menu items were inert or wrongly disabled.
Keep an adapter-flagged tree and its slices in the colleague chain
via IsExternalCommandAdapter, and clear the flag when the legacy view
reactivates so a runtime UI flip does not widen legacy targeting.
Target the adapter's CurrentSlice by object and field name: sibling
rows share one MoForm, and handlers such as GetGuidForJumpToTool
resolve the target from CurrentSlice.Flid. Add
SetCurrentSliceForCommandTarget because ShowObject suspends ordinary
CurrentSlice assignment until an idle callback, silently discarding
the adapter's targeting, and add ClearCurrentSlice as the sanctioned
no-target state. Exclude lazy placeholders via the new
Slice.IsLazyPlaceholder instead of IsRealSlice, which for view-backed
slices reports layout state and is false forever in a tree that is
never shown.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

NUnit Tests

1 files 1 suites 9m 5s ⏱️
5 790 tests 5 709 ✅ 81 💤 0 ❌
5 799 runs 5 718 ✅ 81 💤 0 ❌

Results for commit fab7e11.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 51.40187% with 52 lines in your changes missing coverage. Please review.
✅ Project coverage is 38.26%. Comparing base (d84b2b4) to head (fab7e11).
⚠️ Report is 6 commits behind head on main.

Files with missing linesPatch %Lines
...xWorks/Avalonia/Hosting/RecordEditView.Avalonia.cs62.96%13 Missing and 7 partials ⚠️
Src/Common/Controls/DetailControls/DataTree.cs50.00%10 Missing and 5 partials ⚠️
Src/xWorks/DTMenuHandler.cs10.00%6 Missing and 3 partials ⚠️
...c/Common/Controls/DetailControls/MultiLevelConc.cs0.00%4 Missing ⚠️
Src/Common/Controls/DetailControls/Slice.cs66.66%0 Missing and 2 partials ⚠️
Src/xWorks/RecordEditView.cs33.33%1 Missing and 1 partial ⚠️
Additional details and impacted files
@@ Coverage Diff @@## main #1079 +/- ##
=========================================
+ Coverage 0 38.26% +38.26% 
=========================================
Files 0 1499 +1499 Lines 0 350242 +350242 Branches 0 40259 +40259 =========================================
+ Hits 0 134028 +134028 - Misses 0 186992 +186992 - Partials 0 29222 +29222 
Files with missing linesCoverage Δ
Src/Common/Controls/DetailControls/Slice.cs56.49% <66.66%> (ø)
Src/xWorks/RecordEditView.cs59.11% <33.33%> (ø)
...c/Common/Controls/DetailControls/MultiLevelConc.cs0.00% <0.00%> (ø)
Src/xWorks/DTMenuHandler.cs21.83% <10.00%> (ø)
Src/Common/Controls/DetailControls/DataTree.cs45.89% <50.00%> (ø)
...xWorks/Avalonia/Hosting/RecordEditView.Avalonia.cs45.09% <62.96%> (ø)

... and 1493 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jasonleenaylorjasonleenaylor left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I can see how this is tackling the issue but I have a question about the direction of this commit. I was expecting that we would be implementing more Pub/Sub messaging into the Avalonia DataTree and slices to trigger the updates to the winforms controls which currently track the style, and the writing system that is under the cursor. This covers all the message handling which the DataTree handled by turning the old WinForms data tree into an invisible adapter layer. That's cute and effective, but doesn't move us toward a WinForms free future as much as I'd like. I'm willing to keep going this direction for now if the alternative was considered and ruled out for some reason.

@jasonleenaylor reviewed 2 files and all commit messages, and made 1 comment.
Reviewable status: 2 of 10 files reviewed, all discussions resolved.

@mark-silmark-sil left a comment

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Thanks for your comment, I mis-understood the scope of what we were doing. I was thinking the invisible adapter layer was an intentional design decision since it was already functioning (just not functioning well). I thought the Jira ticket was about fixing the problems with the current design.
I think it makes sense to Publish from the Avalonia view and Subscribe in the WinForms (or other) code. The part that is not clear is the adapters interaction with the Mediator to support command execution. Would we still want to keep that portion of the current design? PubSub currently doesn't do anything with command execution.

@mark-sil made 1 comment.
Reviewable status: 2 of 10 files reviewed, all discussions resolved (waiting on jasonleenaylor).

@jasonleenaylorjasonleenaylor left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

:lgtm:

@jasonleenaylor reviewed 8 files and made 1 comment.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on mark-sil).

@mark-sil
mark-sil merged commit 0f57ab0 into mainAug 19, 2026
8 checks passed
@mark-sil
mark-sil deleted the LT-22691 branch August 19, 2026 15:14
thejambi pushed a commit that referenced this pull request Aug 25, 2026
)
The Avalonia detail host drives the legacy DataTree as a hidden
command-routing adapter, but Mediator message-target selection dropped
invisible trees and slices from the colleague chain. Every handler
defined on the tree itself (JumpToTool, Delete, Insert, Move Field)
and every slice-level handler (the Writing Systems options list) was
unreachable, so those menu items were inert or wrongly disabled.
Keep an adapter-flagged tree and its slices in the colleague chain
via IsExternalCommandAdapter, and clear the flag when the legacy view
reactivates so a runtime UI flip does not widen legacy targeting.
Target the adapter's CurrentSlice by object and field name: sibling
rows share one MoForm, and handlers such as GetGuidForJumpToTool
resolve the target from CurrentSlice.Flid. Add
SetCurrentSliceForCommandTarget because ShowObject suspends ordinary
CurrentSlice assignment until an idle callback, silently discarding
the adapter's targeting, and add ClearCurrentSlice as the sanctioned
no-target state. Exclude lazy placeholders via the new
Slice.IsLazyPlaceholder instead of IsRealSlice, which for view-backed
slices reports layout state and is false forever in a tree that is
never shown.
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Sign up for freeto 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

@mark-sil@codecov-commenter@jasonleenaylor