@@ -107,18 +107,11 @@ export const Edit = (props: { horizontal: boolean }) => {
107
107
const myScratchpad = localStorage . getItem ( 'scratchpad' ) ;
108
108
if ( ! myScratchpad ) {
109
109
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 ( ) ,
117
110
files : defaultTabs . map ( ( x ) => ( {
118
111
name : x . name ,
119
112
content : x . source . split ( '\n' ) ,
120
113
} ) ) ,
121
- } ;
114
+ } as APIRepl ;
122
115
localStorage . setItem ( 'scratchpad' , JSON . stringify ( output ) ) ;
123
116
} else {
124
117
output = JSON . parse ( myScratchpad ) ;
@@ -129,8 +122,6 @@ export const Edit = (props: { horizontal: boolean }) => {
129
122
} ) . then ( ( r ) => r . json ( ) ) ;
130
123
}
131
124
132
- console . log ( 'refetched' ) ;
133
-
134
125
batch ( ( ) => {
135
126
setTabs (
136
127
output . files . map ( ( x ) => {
@@ -152,7 +143,7 @@ export const Edit = (props: { horizontal: boolean }) => {
152
143
const files = tabs ( ) . map ( ( x ) => ( { name : x . name , content : x . source . split ( '\n' ) } ) ) ;
153
144
154
145
if ( scratchpad ( ) ) {
155
- localStorage . setItem ( 'scratchpad' , JSON . stringify ( { ... repl , files } ) ) ;
146
+ localStorage . setItem ( 'scratchpad' , JSON . stringify ( { files } ) ) ;
156
147
} else if ( context . token && context . user ( ) ?. display == params . user ) {
157
148
fetch ( `${ API } /repl/${ params . repl } ` , {
158
149
method : 'PUT' ,
@@ -200,7 +191,7 @@ export const Edit = (props: { horizontal: boolean }) => {
200
191
}
201
192
} }
202
193
>
203
- { resource ( ) && (
194
+ { resource ( ) ?. title && (
204
195
< input
205
196
class = "bg-transparent"
206
197
value = { resource ( ) ?. title }
0 commit comments