Skip to content

Conversation

@kwvanderlinde
Copy link
Collaborator

@kwvanderlinde kwvanderlinde commented Aug 13, 2025

Identify the Bug or Feature request

Fixes #5745

Description of the Change

Changes ZoneViewModel#getSelectedTokenList() to behave like 1.17's ZoneRenderer#getSelectedTokensList(), which resolves the Token objects on demand rather than caching it somewhere.

This fixes the issue since a render is not required for getSelected() to be updated.

Possible Drawbacks

Slight reduction in getSelected() performance and similar, and corresponding increase in memory allocation.

Documentation Notes

N/A

Release Notes

  • Fixed a bug where getSelected() would have out-of-date results when called from onChangeSelection

This change is Reviewable

This is more wasteful, but is identical to 1.17 behaviour and avoids the possibility of stale selection data in case the
zone has not been rerendered after a selection chnage.
@kwvanderlinde kwvanderlinde self-assigned this Aug 13, 2025
@github-actions github-actions bot added the bug label Aug 13, 2025
@kwvanderlinde kwvanderlinde moved this from Todo to Awaiting-Review in MapTool 1.18 Aug 13, 2025
@kwvanderlinde kwvanderlinde changed the title 1.18 - Fix getSelected() race condition 1.18 - Fix getSelected() stale results Aug 13, 2025
@github-project-automation github-project-automation bot moved this from Awaiting-Review to To-Be-Merged in MapTool 1.18 Aug 28, 2025
@kwvanderlinde kwvanderlinde merged commit 43998fb into RPTools:release-1.18 Aug 28, 2025
5 checks passed
@github-project-automation github-project-automation bot moved this from To-Be-Merged to Merged in MapTool 1.18 Aug 28, 2025
@kwvanderlinde kwvanderlinde deleted the bugfix/5745-getSelected-race-condition branch September 2, 2025 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Merged

Development

Successfully merging this pull request may close these issues.

[Bug]: Clicking anywhere after onChangeSelection Macro executes causes onChangeSelection to run again as if same token was clicked.

2 participants