From 740b6e1389911eeea860cfccd4bad218fe33f3bd Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Thu, 16 May 2024 21:04:25 +0800 Subject: Fix JS error when editing a merged PR's title (#30990) --- web_src/js/features/repo-issue.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'web_src/js') diff --git a/web_src/js/features/repo-issue.js b/web_src/js/features/repo-issue.js index 8ee681aedc..519db34934 100644 --- a/web_src/js/features/repo-issue.js +++ b/web_src/js/features/repo-issue.js @@ -626,9 +626,12 @@ export function initRepoIssueTitleEdit() { showElem(issueTitleDisplay); showElem('#pull-desc-display'); }); + + const pullDescEditor = document.querySelector('#pull-desc-editor'); // it may not exist for a merged PR + const prTargetUpdateUrl = pullDescEditor?.getAttribute('data-target-update-url'); + const editSaveButton = issueTitleEditor.querySelector('.ui.primary.button'); editSaveButton.addEventListener('click', async () => { - const prTargetUpdateUrl = editSaveButton.getAttribute('data-target-update-url'); const newTitle = issueTitleInput.value.trim(); try { if (newTitle && newTitle !== oldTitle) { -- cgit v1.2.3