Skip to content

Commit aa23641

Browse files
Merge pull request #2110 from m-click/fix-null-markers
Fix handling of a null or absent "markers" property
2 parents f94df43 + 72904ed commit aa23641

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/ace.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -421,11 +421,10 @@ export default class ReactAce extends React.Component<IAceEditorProps> {
421421
if (valueChanged || !isEqual(nextProps.annotations, oldProps.annotations)) {
422422
this.editor.getSession().setAnnotations(nextProps.annotations || []);
423423
}
424-
if (
425-
!isEqual(nextProps.markers, oldProps.markers) &&
426-
Array.isArray(nextProps.markers)
427-
) {
428-
this.handleMarkers(nextProps.markers);
424+
const oldMarkers = oldProps.markers || [];
425+
const nextMarkers = nextProps.markers || [];
426+
if (!isEqual(oldMarkers, nextMarkers)) {
427+
this.handleMarkers(nextMarkers);
429428
}
430429

431430
// this doesn't look like it works at all....

0 commit comments

Comments
 (0)