1
0
mirror of https://github.com/gristlabs/grist-core.git synced 2024-10-27 20:44:07 +00:00

fix: removing wheel reinvention of urlStates

This commit is contained in:
Grégoire Cutzach 2024-10-07 18:29:58 +02:00
parent fbc911721e
commit 2f2f50488f
No known key found for this signature in database
GPG Key ID: AA4155BE23C375E6

View File

@ -333,14 +333,12 @@ export class DocSettingsPage extends Disposable {
docType = "tutorial";
}
await persistType(docType, docId);
const currentUrl = window.location.href;
const urlId = currentUrl.split("/docs/")[1];
const cleanUrlId = urlId.match(/^doc\/.*/) ? urlId.split("/")[1] : urlId.split("/")[0];
const shortDocId = urlId?.split("~")[0];
const reloadUrl = urlId.match(/^doc\/.*/) ?
currentUrl.replace(`doc/${cleanUrlId}`, shortDocId) :
currentUrl.replace(cleanUrlId, shortDocId);
window.location.replace(reloadUrl ?? "");
const {trunkId} = docPageModel.currentDoc.get()!.idParts;
window.location.replace(urlState().makeUrl({
docPage: "settings",
fork: undefined, // will be automatically set once the page is reloaded
doc: trunkId,
}));
};
const documentTypeOptions = () => [