Skip to content

Commit d29b554

Browse files
committed
Handle failure scenarios better.
1 parent 775380a commit d29b554

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

playground/next/editor.bundle.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39990,14 +39990,14 @@ ${O$2.repeat(r.depth)}}`:r.close="}";break}case f$4.TAG:e+=String(i),e+=a(f$4.PO
3999039990
},
3999139991
gatherHash() {
3999239992
const url = new URL(window.location);
39993-
const hash = new URLSearchParams(url.hash.slice(1));
39994-
this.contextDoc = JSON.parse(hash.get('context') || {});
39993+
const hash = new URLSearchParams(url?.hash.slice(1));
39994+
this.contextDoc = JSON.parse(hash.get('context')) || {};
3999539995
setEditorValue(this.contextEditor, this.contextDoc);
39996-
this.frameDoc = JSON.parse(hash.get('frame') || {});
39996+
this.frameDoc = JSON.parse(hash.get('frame')) || {};
3999739997
setEditorValue(this.frameEditor, this.frameDoc);
39998-
this.doc = JSON.parse(hash.get('json-ld') || {});
39998+
this.doc = JSON.parse(hash.get('json-ld')) || {};
3999939999
setEditorValue(this.mainEditor, this.doc);
40000-
this.outputTab = hash.get('startTab').slice(4);
40000+
this.outputTab = hash.get('startTab')?.slice(4);
4000140001
}
4000240002
}).mount();
4000340003

playground/next/editor.mjs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -563,13 +563,13 @@ window.app = createApp({
563563
},
564564
gatherHash() {
565565
const url = new URL(window.location);
566-
const hash = new URLSearchParams(url.hash.slice(1));
567-
this.contextDoc = JSON.parse(hash.get('context') || {});
566+
const hash = new URLSearchParams(url?.hash.slice(1));
567+
this.contextDoc = JSON.parse(hash.get('context')) || {};
568568
setEditorValue(this.contextEditor, this.contextDoc);
569-
this.frameDoc = JSON.parse(hash.get('frame') || {});
569+
this.frameDoc = JSON.parse(hash.get('frame')) || {};
570570
setEditorValue(this.frameEditor, this.frameDoc);
571-
this.doc = JSON.parse(hash.get('json-ld') || {});
571+
this.doc = JSON.parse(hash.get('json-ld')) || {};
572572
setEditorValue(this.mainEditor, this.doc);
573-
this.outputTab = hash.get('startTab').slice(4);
573+
this.outputTab = hash.get('startTab')?.slice(4);
574574
}
575575
}).mount();

0 commit comments

Comments
 (0)