Skip to content

feat: make cacheAllConnectionPairs public#10149

Merged
mikeharv merged 1 commit into
RaspberryPiFoundation:mainfrom
mikeharv:public-cache
Jul 17, 2026
Merged

feat: make cacheAllConnectionPairs public#10149
mikeharv merged 1 commit into
RaspberryPiFoundation:mainfrom
mikeharv:public-cache

Conversation

@mikeharv

@mikeharv mikeharv commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

The basics

The details

Resolves

Fixes RaspberryPiFoundation/blockly-samples#2708 (Requires plugin update as well)

Proposed Changes

  • Make BlockDragStrategy.cacheAllConnectionPairs() public so consumers can refresh the cached connection pairs during an active drag.
  • Call this method for all types of block drag, not just keyboard-driven

Reason for Changes

BlockDragStrategy caches valid connection pairs when a drag begins. If another block changes shape during the drag, such as a plugin dynamically adds an input, the cache does not contain the new connection. This is required to make @blockly/block-dynamic-connection work correctly with keyboard move mode.

Cached connections are also necessary for ensuring properly verbose move mode announcements (e.g. disambiguating similar connections on a neighbour), but this information was missing for pointer drags.

Test Coverage

Added Mocha tests:

  • Confirm recaching adds the new connection and that it wasn't there previously.
  • Confirm constrained traversal visits the existing input followed by the newly added input in the expected order.

Documentation

Additional Information

See RaspberryPiFoundation/blockly-samples#2751 for corresponding plugin change.

@mikeharv
mikeharv merged commit e40b869 into RaspberryPiFoundation:main Jul 17, 2026
15 checks passed
@maribethb maribethb added PR: feature Adds a feature and removed PR: fix Fixes a bug labels Jul 17, 2026
@maribethb maribethb changed the title fix: make cacheAllConnectionPairs public feat: make cacheAllConnectionPairs public Jul 17, 2026
@github-actions github-actions Bot added PR: feature Adds a feature and removed PR: feature Adds a feature labels Jul 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: feature Adds a feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Connections added by block-dynamic-connection are not available in keyboard move mode

3 participants