From 54081da091e91d0d487e5e26325ef70d4e7c8702 Mon Sep 17 00:00:00 2001 From: Kerwin Bryant Date: Mon, 3 Mar 2025 08:55:21 +0000 Subject: [PATCH 1/2] Refactor initRepoBranchTagSelector using the new registerGlobalInitFunc --- templates/repo/branch_dropdown.tmpl | 2 +- web_src/js/features/repo-legacy.ts | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/templates/repo/branch_dropdown.tmpl b/templates/repo/branch_dropdown.tmpl index 6efed3427f44d..1bfd9a7913fdc 100644 --- a/templates/repo/branch_dropdown.tmpl +++ b/templates/repo/branch_dropdown.tmpl @@ -14,7 +14,7 @@ Search "repo/branch_dropdown" in the template directory to find all occurrences. */}} -
{ + createApp(RepoBranchTagSelector, {el}).mount(el); + }); } export function initBranchSelectorTabs() { @@ -42,7 +43,7 @@ export function initRepository() { const pageContent = document.querySelector('.page-content.repository'); if (!pageContent) return; - initRepoBranchTagSelector('.js-branch-tag-selector'); + initRepoBranchTagSelector(); initRepoCommentFormAndSidebar(); // Labels From 0074d41aa2a5647fa5d26e9d3fcec39ae5c0de50 Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Mon, 3 Mar 2025 17:42:10 +0800 Subject: [PATCH 2/2] clean up --- templates/repo/branch_dropdown.tmpl | 3 ++- templates/repo/release/list.tmpl | 1 + web_src/css/repo/release-tag.css | 2 +- web_src/js/features/repo-legacy.ts | 4 ++-- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/templates/repo/branch_dropdown.tmpl b/templates/repo/branch_dropdown.tmpl index 1bfd9a7913fdc..f679b8744bf51 100644 --- a/templates/repo/branch_dropdown.tmpl +++ b/templates/repo/branch_dropdown.tmpl @@ -14,7 +14,8 @@ Search "repo/branch_dropdown" in the template directory to find all occurrences. */}} -
{ - createApp(RepoBranchTagSelector, {el}).mount(el); + registerGlobalInitFunc('initRepoBranchTagSelector', async (elRoot: HTMLInputElement) => { + createApp(RepoBranchTagSelector, {elRoot}).mount(elRoot); }); }