Skip to content

Commit 5134fb9

Browse files
Address copilot pass 8 on #2
- doctor.js: hideAddKeySection() at the start of the submit handler (before awaiting runAll). Without this, a stale snippet from a previous run remained visible — and clickable — during a new run, so a user could copy or apply a snippet rooted at the wrong WebID. - doctor.js: clearSignerOutput() when revealing the add-key section. Without this, after diagnostics complete on a NEW WebID, the old pubkey/snippet from the previous run was still visible until the user clicked reconnect — same accidental-copy hazard.
1 parent 86fc7a2 commit 5134fb9

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

doctor.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ form.addEventListener('submit', async (e) => {
5252
checksEl.innerHTML = '';
5353
rawEl.textContent = '';
5454
results.hidden = false;
55+
// Hide the add-key UI immediately so a stale snippet from a previous
56+
// run can't be copied or have its connect button clicked while the
57+
// new diagnostics are in flight.
58+
hideAddKeySection();
5559

5660
try {
5761
const { checks, profileFetched, webId, docUrl } = await runAll(url);
@@ -186,6 +190,10 @@ async function runAll(webIdUrl) {
186190

187191
function revealAddKeySection() {
188192
addKeySection.hidden = false;
193+
// The WebID may have changed since the section was last shown; clear
194+
// any prior pubkey/snippet so the user can't accidentally copy a
195+
// snippet rooted at the previous WebID.
196+
clearSignerOutput();
189197
detectSigner();
190198
}
191199

0 commit comments

Comments
 (0)