@@ -107,18 +107,11 @@ export const Edit = (props: { horizontal: boolean }) => {
107107 const myScratchpad = localStorage . getItem ( 'scratchpad' ) ;
108108 if ( ! myScratchpad ) {
109109 output = {
110- id : 'scratchpad' ,
111- title : 'Scratchpad' ,
112- public : true ,
113- version : '1.0' ,
114- labels : [ ] ,
115- size : 0 ,
116- created_at : new Date ( ) . toISOString ( ) ,
117110 files : defaultTabs . map ( ( x ) => ( {
118111 name : x . name ,
119112 content : x . source . split ( '\n' ) ,
120113 } ) ) ,
121- } ;
114+ } as APIRepl ;
122115 localStorage . setItem ( 'scratchpad' , JSON . stringify ( output ) ) ;
123116 } else {
124117 output = JSON . parse ( myScratchpad ) ;
@@ -129,8 +122,6 @@ export const Edit = (props: { horizontal: boolean }) => {
129122 } ) . then ( ( r ) => r . json ( ) ) ;
130123 }
131124
132- console . log ( 'refetched' ) ;
133-
134125 batch ( ( ) => {
135126 setTabs (
136127 output . files . map ( ( x ) => {
@@ -152,7 +143,7 @@ export const Edit = (props: { horizontal: boolean }) => {
152143 const files = tabs ( ) . map ( ( x ) => ( { name : x . name , content : x . source . split ( '\n' ) } ) ) ;
153144
154145 if ( scratchpad ( ) ) {
155- localStorage . setItem ( 'scratchpad' , JSON . stringify ( { ... repl , files } ) ) ;
146+ localStorage . setItem ( 'scratchpad' , JSON . stringify ( { files } ) ) ;
156147 } else if ( context . token && context . user ( ) ?. display == params . user ) {
157148 fetch ( `${ API } /repl/${ params . repl } ` , {
158149 method : 'PUT' ,
@@ -200,7 +191,7 @@ export const Edit = (props: { horizontal: boolean }) => {
200191 }
201192 } }
202193 >
203- { resource ( ) && (
194+ { resource ( ) ?. title && (
204195 < input
205196 class = "bg-transparent"
206197 value = { resource ( ) ?. title }
0 commit comments