Skip to content

fix(tiles controller): wrong finish notify timing#2

Open
Kurtil wants to merge 2 commits intomainfrom
fix/tileControllerFinishNotifyTiming
Open

fix(tiles controller): wrong finish notify timing#2
Kurtil wants to merge 2 commits intomainfrom
fix/tileControllerFinishNotifyTiming

Conversation

@Kurtil
Copy link
Copy Markdown
Member

@Kurtil Kurtil commented Apr 20, 2026

PR Description

This PR fixes an ordering issue in the virtual tile update loop that could leave tiles in an inconsistent visual state during large batch updates.

Context

When performing bulk operations such as:

unhighlight all highlighted elements, or
visibility changes over a large number of objects,
some tiles could remain highlighted (or visible) even though the requested state was the opposite.

Root Cause

The update cycle completion notification was being sent before all pending tile UPDATE messages were dispatched for changed tiles.
In heavy batches, this could mark the cycle as finished while there were still tile state changes waiting to be sent/applied, causing stale highlight/visibility data on some tiles.

Fix

The update completion signal is now sent only after:

all changed tiles have been processed and UPDATE requests have been queued, and
the changed-tiles set has been cleared.
This guarantees the FINISH notification reflects the real end of the update batch.

Result

Highlight/visibility operations are now consistent during mass updates.
No more “stuck highlighted” or “stuck visible/invisible” tiles caused by early completion signaling.
Improves reliability of state synchronization between tile controller and mesh processing pipeline.
Validation
Manually verified with bulk highlight/unhighlight and bulk visibility toggles on large models; tile states now converge correctly with no lingering mismatches.

What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following:

  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Follow the Conventional Commits v1.0.0 standard for PR naming (e.g. feat(examples): add hello-world example).
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

@Kurtil Kurtil requested a review from Copilot April 20, 2026 15:57
@Kurtil Kurtil self-assigned this Apr 20, 2026
@Kurtil Kurtil added the bug Something isn't working label Apr 20, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a tile-update ordering issue by ensuring the “update finished” (FINISH) notification is queued only after all pending tile UPDATE requests have been queued and the changed-tiles set has been cleared, preventing stale highlight/visibility state during large batch operations.

Changes:

  • Move notifyUpdateFinished() to run after all _tilesChanged UPDATE requests are queued.
  • Ensure _tilesChanged is cleared before sending the FINISH request.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants