fix!(connection): Correctly handle multiple highlighted RenderedConnections #6416
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.
The basics
npm run format
andnpm run lint
The details
Resolves
Issue reported in forum.
Proposed Changes
Modify
RenderedConnection.prototype.highlight
and.unhighlight
to store the highlight path onthis
rather than as a static property onConnection
(which is where it had been stored since this functionality was originally created, apaprently prior to RenderedConnection and Connection being split).Behaviour Before Change
Calling
.unhighlight
on aRenderedConnection
instance unhighlighted the most recently-highlighted connection, not necessarilythis
one.Behaviour After Change
Calling
.unhighlight
on aRenderedConnection
unhighlightsthis
connection, if it was highlighted (and does nothing if not).Reason for Changes
To make it possible to highlight more than one connection at a time—and, critically, to then be able to unhighlight any/all of them later.
Test Coverage
Passes
npm test
.Manual testing: I have done a basic check in the playground to verify that connection highlighting appears to be working as expected, but being alert to any issues about this in manual testing would be great.
Documentation
The documentation already documented the new behaviour.
BREAKING CHANGE:
This change will break any third-party code which incorrectly relied on
.unhighlight
unconditionally removing the most recently-created highlight.