Repository navigation
Replace XhtmlDocView's SelectedPublication broadcasts with direct calls - #1195
Merged
Merged
Conversation
XhtmlDocView set SelectedPublication with the broadcast flag at two sites whose only listener is the view itself: RefreshAllContent, which F5's MasterRefresh and the DictionaryConfigured event reach, when the current configuration excludes the selected publication, and OnShowAllEntries, the handler of the ShowAllEntries command. The xCore Mediator delivered those broadcasts after the caller had returned, so RefreshAllContent loaded the configuration it had computed and the deferred handler then asked for the configuration valid for the new publication. A second load followed whenever that was another file or the publication fell back to All Entries, and the right configuration ended up loaded only because the deferred load came last. Both sites now store SelectedPublication without a broadcast and do the handler's work directly, in place of the deferred load. RefreshAllContent loads once: the configuration valid for the publication it moved to, or the current configuration when the publication stays. Show All Entries loads once, and choosing it while All Entries is already selected changes nothing, as the PropertyTable's change-only broadcast made it before. The OnPropertyChanged case for SelectedPublication stays, because the publication menus (ChoiceGroup) and the window's default properties still set the name with a broadcast. The value stays in the PropertyTable because GetCurrentPublication, XhtmlRecordDocView and ConfiguredLcmGenerator read it while the content is generated. The DictionaryPublicationLayout and ReversalIndexPublicationLayout handler and m_updateContentLater are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1195 +/- ##
==========================================
+ Coverage 39.63% 39.75% +0.12%
==========================================
Files 1541 1544 +3
Lines 354882 355096 +214
Branches 41176 41248 +72
==========================================
+ Hits 140662 141175 +513
+ Misses 184831 184562 -269
+ Partials 29389 29359 -30
🚀 New features to boost your workflow:
|
thejambi
approved these changes
Oct 20, 2026
thejambi
left a comment
Contributor
There was a problem hiding this comment.
@thejambi reviewed 2 files and all commit messages, and made 1 comment.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on mark-sil).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Start here:
ShowConfigurationandShowSelectedPublicationinSrc/xWorks/XhtmlDocView.cs, then their two callers,RefreshAllContentandOnShowAllEntries.XhtmlDocView no longer broadcasts
SelectedPublicationto itself.RefreshAllContent(reached by F5, the Configure dialog'sDictionaryConfiguredevent andRefreshCurrentView) andOnShowAllEntries(the pane bar's "All Entries" item) now store the property with the broadcast flag off and run the handler's work directly: choose the configuration valid for the publication, then load it. Each loads the content once.Does the end state change? No. When the current layout excluded the selected publication,
RefreshAllContentstored the new publication, loaded the layout it already had, and the queued broadcast then loaded the layout valid for the new publication.UpdateContent's duplicate-load guard usually hid that second load. It still ran when the publication fell back to All Entries or the valid layout was another file, and only the queue order put the right layout last. A synchronous call in the old position would have loaded the stale layout last.ShowConfigurationnow chooses before it loads, so its one load is of the layout the deferred handler used to end on.Where to look
OnPropertyChangedcase forSelectedPublicationstays: the pane bar publication menus (ChoiceGroup), the window's default properties and the first read of an unset property still broadcast the name.Not here: those three paths keep the Mediator broadcast until property-change delivery moves to Pub/Sub.
Verification
build.ps1 -CommentHygiene -TokenHygiene: clean.test.ps1 -TestProject xWorksTests: 1794 passed, 2 skipped, 0 failed.XhtmlDocViewTestsassert one load, the right configuration and no queued broadcast.Next: approve.
Reading this a year from now -- start here
This is one step of moving xCore
PropertyTablechange notification (SetProperty(..., true)->Mediator.BroadcastString("OnPropertyChanged", name), delivered from the window's message pump after the caller returns) to direct calls or FwUtils Pub/Sub. Sites whose only listener is the setter itself are converted by calling the listener's work directly, at the point where the deferred delivery used to take effect. The value is still stored, because readers depend on it, but without the broadcast.Decisions, and why
ShowSelectedPublicationis exactly what theSelectedPublicationhandler case did. Keeping the menu path and the direct paths on the same code means the two cannot drift.ShowConfigurationdecides before loading. InRefreshAllContentthe publication check now chooses between "load the configuration passed in" and "move the publication, then load its valid configuration", instead of loading first and correcting later. That removes both the stale-order hazard and the second load.OnShowAllEntries.SetPropertybroadcast only when the value changed. Choosing All Entries while it is selected did nothing, and still does nothing.UpdateContentisprotected virtualso the test subclass can record loads without Gecko or a progress dialog. Nothing in production derives fromXhtmlDocView.m_updateContentLaterand the layout handler are untouched. Neither depended on theSelectedPublicationbroadcast arriving later.Who still broadcasts SelectedPublication
singlePropertyAtomicValuemenus:Lexicon/areaConfiguration.xml(Dictionary tool pane bar) andMain.xml(Reversal Indexes pane bar), throughChoiceGroup.ChooseSinglePropertyAtomicValue.xWindow.LoadDefaultProperties, for theSelectedPublicationdefault "Main Dictionary" when no value exists yet.PropertyTable.GetStringProperty/GetValuewith a default, which store and broadcast the default when the property is missing. Readers:GetCurrentPublicationinXhtmlDocViewandXhtmlRecordDocView,ConfiguredLcmGenerator.CurrentDecorator,XhtmlDocView.IsObjectVisible.Preflight review details
Code Review Summary
Branch: claude/pubsub-selected-publication-d85c54
Base: main
Review model: Claude Opus 5.5
Files changed: 2
Overview
Converts XhtmlDocView's two self-broadcasting
SelectedPublicationsets to plain sets plus a direct call of the handler's work, loading once with the end state the deferred handler produced. Developer-facing Pub/Sub migration step. The behaviour a tester can see is one load instead of an occasional two.Contract/API Changes
None outside the class.
UpdateContentmoved from private to protected virtual.ShowConfigurationis a new internal method.Findings
Important - Should address before merge
ShowConfiguration_ValidConfigurationIsAnotherFile_LoadsOnlyTheValidOne)Minor - Consider
Reversal layout switch with the publication excluded now loads before the list reload(same order as the valid-publication path; verified manually)Show All Entries loads synchronously inside the menu command(F5 already does the same)Exceptions from configuration gathering now surface through Publish(the same subscribers already read the same files inUpdateContent)(no production subclasses)UpdateContentwidened for the test seamThe All Entries guard skips an unset property(reading an unset property stores and broadcasts the default, so the end state is unchanged)Required Validation / Evidence
Build and xWorksTests as listed above. All manual steps were run and passed.
Interview Notes
All manual tests passed, and the code and the commit message were reviewed. Pub/Sub migration work carries no Jira ticket for now.
🤖 Generated with Claude Code
This change is