Run the FetchStats analysis once per selection - #417
Draft
CarsonDavis wants to merge 2 commits into
Draft
Conversation
The modern layout starts the plugin through initialize() and make(), and both subscribed to the AOI selection, so one selection ran the statistics round twice. The second start is now a no-op, and a run still in flight when the plugin is destroyed no longer reaches the bus.
This was referenced Sep 10, 2026
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.
One AOI selection now makes one statistics request per layer, and unloading FetchStats mid-run silences it.
Closes #412
One selection, one request per layer
Previously, selecting an AOI queried every eligible visible layer twice, and the AOI progress readout counted doubled steps against a total it never cleanly reached.
The modern tool controller calls
initialize()and thenmake(targetId), andinitialize()itself already callsmake(null), so the AOI subscription registered twice and every selection fired both listeners.The fix: a
madeguard makes the second start a no-op, leaving one listener. Demo mission: yes, the demo is the modern layout and includes FetchStats.Unloading the plugin mid-analysis goes quiet
Previously, a run in flight kept emitting progress, result, and skip messages onto the bus after teardown, so listeners heard from a plugin that no longer existed.
destroy()never dropped_api, and the four emit sites called it unconditionally.The fix:
destroy()nulls_apiand the emits are optional-chained.Classic Layout Stuff
The classic layout still answers a selection
Classic only calls
initialize(), which is why the double query was modern-layout only and why the guard must not break the single start. It doesn't: one subscription there too, asserted by a test. Demo mission: no, only the test covers this.AOI drives its progress readout off
analysisProgressand only returns to idle onanalysisReady, so tearing FetchStats down mid-run while AOI outlives it leaves AOI showing "running"; cancelling a run in flight is a separate issue.