Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Marker changes did not trigger change:data #11506

Merged
merged 1 commit into from
Mar 22, 2022
Merged

Marker changes did not trigger change:data #11506

merged 1 commit into from
Mar 22, 2022

Conversation

scofalik
Copy link
Contributor

Suggested merge commit message (convention)

Fix (engine): Marker changes sometimes did not trigger change:data event which resulted in errors in features using markers (for example, annotations not showing up in the sidebar).

…event which resulted in errors in features using markers (for example, annotations not showing up in the sidebar).
Comment on lines +339 to +341
if ( this._changesInElement.size > 0 ) {
return true;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was moved to the beginning but it makes sense, if there are any "regular" changes in the differ, return true.

for ( const { newMarkerData, oldMarkerData } of this._changedMarkers.values() ) {
if ( newMarkerData.affectsData !== oldMarkerData.affectsData ) {
return true;
}

if ( newMarkerData.affectsData ) {
// Skip markers, which ranges have not changed.
if ( newMarkerData.range && oldMarkerData.range && newMarkerData.range.isEqual( oldMarkerData.range ) ) {
return false;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was incorrect early false, it should have been continue or changed as I did.

Comment on lines +1671 to +1677
it( 'should return `true` if at least one marker changed', () => {
differ.bufferMarkerChange( 'nameA', { range, affectsData: true }, { range, affectsData: true } );
differ.bufferMarkerChange( 'nameB', { range, affectsData: true }, { range: rangeB, affectsData: true } );
differ.bufferMarkerChange( 'nameC', { range, affectsData: true }, { range, affectsData: true } );

expect( differ.hasDataChanges() ).to.be.true;
} );
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a new test, all the other are re-arranged or modified.

@ma2ciek
Copy link
Contributor

ma2ciek commented Mar 22, 2022

Oh, that's my fault 🙈  This change looks good to me.

@niegowski niegowski merged commit 59c0319 into master Mar 22, 2022
@niegowski niegowski deleted the cf/4495 branch March 22, 2022 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants