diff --git a/webapp/src/app.tsx b/webapp/src/app.tsx index f27249643ed8..b5eafcce47c8 100644 --- a/webapp/src/app.tsx +++ b/webapp/src/app.tsx @@ -5387,9 +5387,18 @@ async function importGithubProject(repoid: string, requireSignin?: boolean) { function loadHeaderBySharedId(id: string) { core.showLoading("loadingheader", lf("loading project...")); + let previousHeader: pxt.workspace.Header; + if (id.startsWith("S") && auth.hasIdentity() && data.getData(auth.LOGGED_IN)) { + // if loading a persistent url, check for existing headers + previousHeader = workspace.getHeaders().find(h => h.pubPermalink === id); + } + + const projHeaderPromise = previousHeader + ? Promise.resolve(previousHeader) + : workspace.installByIdAsync(id); - workspace.installByIdAsync(id) - .then(hd => theEditor.loadHeaderAsync(hd, null)) + projHeaderPromise + .then(hd => theEditor.loadHeaderAsync(hd, null, !!previousHeader)) .catch(e => { theEditor.openHome(); core.handleNetworkError(e);