Fix JS error when editing a merged PR's title (#30990)

This commit is contained in:
wxiaoguang 2024-05-16 21:04:25 +08:00 committed by GitHub
parent 2611249511
commit 740b6e1389
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 5 deletions

View file

@ -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) {