diff --git a/cypress/integration/actions.spec.ts b/cypress/integration/actions.spec.ts index 6a2a8268..bcef5906 100644 --- a/cypress/integration/actions.spec.ts +++ b/cypress/integration/actions.spec.ts @@ -17,4 +17,10 @@ describe('Check actions', () => { }); }); }); + + it('should load gists from URL', () => { + cy.get('#gist').type('https://gist.github.com/sidharthv96/6268a23e673a533dcb198f241fd7012a'); + cy.contains('Load Gist').click(); + cy.contains('Go shopping!!'); + }); }); diff --git a/src/lib/components/actions.svelte b/src/lib/components/actions.svelte index ef3c03b4..438fd566 100644 --- a/src/lib/components/actions.svelte +++ b/src/lib/components/actions.svelte @@ -121,8 +121,8 @@ if (!gistURL) { alert('Please enter a Gist URL first'); } - goto(`/edit?gist=${gistURL}`); - location.reload(); + window.location.href = `/edit?gist=${gistURL}`; + // location.reload(); }; let iUrl: string; diff --git a/src/lib/util/fileLoaders/loader.ts b/src/lib/util/fileLoaders/loader.ts index 9207b576..02b73aa2 100644 --- a/src/lib/util/fileLoaders/loader.ts +++ b/src/lib/util/fileLoaders/loader.ts @@ -38,9 +38,6 @@ export const loadDataFromUrl = async (): Promise => { state = { code, mermaid: config, - autoSync: true, - updateDiagram: true, - updateEditor: true, loader: { type: 'files', config: { @@ -48,8 +45,14 @@ export const loadDataFromUrl = async (): Promise => { configURL } } - }; + } as State; } - loaded && updateCodeStore(state); + loaded && + updateCodeStore({ + ...state, + autoSync: true, + updateDiagram: true, + updateEditor: true + }); // window.location.search = ''; };