From 8fe26fb314f1710139728d9118b455fc6a16cce2 Mon Sep 17 00:00:00 2001 From: silverwind Date: Mon, 25 Mar 2024 19:37:55 +0100 Subject: [PATCH] Refactor all `.length === 0` patterns in JS (#30045) This pattern comes of often during review, so let's fix it once and for all. Did not test, but changes are trivial enough imho. --- web_src/js/components/DiffCommitSelector.vue | 4 ++-- web_src/js/components/RepoActionView.vue | 2 +- web_src/js/components/RepoBranchTagSelector.vue | 8 +++++--- web_src/js/features/admin/common.js | 4 +--- web_src/js/features/common-global.js | 2 +- web_src/js/features/comp/SearchUserBox.js | 2 +- web_src/js/features/repo-diff.js | 3 +-- web_src/js/features/repo-editor.js | 10 ++++------ web_src/js/features/repo-findfile.js | 2 +- web_src/js/features/repo-home.js | 4 ++-- web_src/js/features/repo-issue.js | 14 ++++++-------- web_src/js/features/repo-legacy.js | 12 ++++-------- web_src/js/features/repo-settings.js | 2 +- web_src/js/features/user-settings.js | 2 +- 14 files changed, 31 insertions(+), 40 deletions(-) diff --git a/web_src/js/components/DiffCommitSelector.vue b/web_src/js/components/DiffCommitSelector.vue index d58337e093..cbb1f20873 100644 --- a/web_src/js/components/DiffCommitSelector.vue +++ b/web_src/js/components/DiffCommitSelector.vue @@ -103,7 +103,7 @@ export default { this.menuVisible = !this.menuVisible; // load our commits when the menu is not yet visible (it'll be toggled after loading) // and we got no commits - if (this.commits.length === 0 && this.menuVisible && !this.isLoading) { + if (!this.commits.length && this.menuVisible && !this.isLoading) { this.isLoading = true; try { await this.fetchCommits(); @@ -216,7 +216,7 @@ export default {