Skip to content

Commit 67d21dd

Browse files
committed
refactor: . Flip if/else
1 parent 29ddb49 commit 67d21dd

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

src/Renderer/QueryRenderer.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -181,16 +181,18 @@ class QueryRenderChild extends MarkdownRenderChild {
181181

182182
// entry describes a single visibility change for the specific element we are observing.
183183
// It is safe to assume `entry.target === this.containerEl` here.
184-
if (entry.isIntersecting) {
185-
this.queryResultsRenderer.query.debug(
186-
`[render][observer] Became visible, isCacheChangedSinceLastRedraw:${this.isCacheChangedSinceLastRedraw}`,
187-
);
188-
if (this.isCacheChangedSinceLastRedraw) {
189-
this.queryResultsRenderer.query.debug('[render][observer] ... updating search results');
190-
this.render({ tasks: this.plugin.getTasks(), state: this.plugin.getState() })
191-
.then()
192-
.catch((e) => console.error(e));
193-
}
184+
if (!entry.isIntersecting) {
185+
return;
186+
}
187+
188+
this.queryResultsRenderer.query.debug(
189+
`[render][observer] Became visible, isCacheChangedSinceLastRedraw:${this.isCacheChangedSinceLastRedraw}`,
190+
);
191+
if (this.isCacheChangedSinceLastRedraw) {
192+
this.queryResultsRenderer.query.debug('[render][observer] ... updating search results');
193+
this.render({ tasks: this.plugin.getTasks(), state: this.plugin.getState() })
194+
.then()
195+
.catch((e) => console.error(e));
194196
}
195197
});
196198

0 commit comments

Comments
 (0)