Skip to content

Commit c3a155e

Browse files
authored
refactor(superdoc): drop redundant === false checks (SD-2867 phase B) (#3067)
* refactor(superdoc): type three implicit-any locals (SD-2867 phase B) * refactor(superdoc): type four implicit-any params (SD-2867 phase B) * refactor(superdoc): cast doc.ydoc in setLocked (SD-2867 phase B) * refactor(superdoc): drop redundant === false checks (SD-2867 phase B)
1 parent db5902c commit c3a155e

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

packages/superdoc/src/core/SuperDoc.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,10 @@ export class SuperDoc extends EventEmitter {
497497
}
498498
this.superdocStore.init(this.config);
499499
const commentsModuleConfig = this.config.modules.comments;
500-
this.commentsStore.init(commentsModuleConfig && commentsModuleConfig !== false ? commentsModuleConfig : {});
500+
// `commentsModuleConfig` is `false | object | undefined`. A truthy
501+
// check already rules out both `false` and `undefined`, so an
502+
// explicit `!== false` afterwards is redundant.
503+
this.commentsStore.init(commentsModuleConfig || {});
501504
if (this.isCollaborative) {
502505
initCollaborationComments(this);
503506
}
@@ -1217,7 +1220,10 @@ export class SuperDoc extends EventEmitter {
12171220
*/
12181221
scrollToComment(commentId, options = {}) {
12191222
const commentsConfig = this.config?.modules?.comments;
1220-
if (!commentsConfig || commentsConfig === false) return false;
1223+
// `commentsConfig` can be `false | object | undefined`; `!commentsConfig`
1224+
// already covers both `false` and `undefined`, so the secondary
1225+
// `=== false` check below is redundant.
1226+
if (!commentsConfig) return false;
12211227
if (!commentId || typeof commentId !== 'string') return false;
12221228

12231229
const root = this.element || document;

0 commit comments

Comments
 (0)