File tree Expand file tree Collapse file tree 1 file changed +3
-6
lines changed
Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Original file line number Diff line number Diff line change 22
33const query = new URLSearchParams ( document . location . hash . slice ( 1 ) ) ;
44
5- let isGist = query . has ( 'gist' ) ;
6-
75const EXTENSIONS = {
86 __proto__ : null ,
97 script : 'js' ,
@@ -19,6 +17,7 @@ const initial = new Map([
1917let state ;
2018
2119if ( query . has ( 'gist' ) ) {
20+ initial . set ( 'gist' , query . get ( 'gist' ) ) ;
2221 state = fetch ( `https://api.github.com/gists/${ query . get ( 'gist' ) } ` )
2322 . then ( ( r ) => r . json ( ) )
2423 . then ( ( data ) => {
@@ -69,8 +68,8 @@ export function updateState() {
6968 return state
7069 . then ( ( s ) => {
7170 const params = new URLSearchParams ( ) ;
72- if ( isGist ) {
73- params . set ( 'gist' , query . get ( 'gist' ) ) ;
71+ if ( s . has ( 'gist' ) ) {
72+ params . set ( 'gist' , s . get ( 'gist' ) ) ;
7473 } else {
7574 params . set ( 'code' , LZString . compressToBase64 ( s . get ( 'code' ) ) ) ;
7675 params . set ( 'mode' , s . get ( 'mode' ) ) ;
@@ -103,9 +102,7 @@ document.querySelector('#save-to-gist')
103102 features : [ ...s . get ( 'features' ) ] ,
104103 } ,
105104 } ) ,
106-
107105 } ) . then ( ( r ) => r . text ( ) ) ;
108- isGist = true ;
109106 s . set ( 'gist' , id ) ;
110107 await updateState ( ) ;
111108 } ) ;
You can’t perform that action at this time.
0 commit comments