File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -42,7 +42,12 @@ export function getNotebooks() {
4242  if  ( ! files )  return  [ ] ; 
4343  const  notebooks  =  JSON . parse ( files ) . sort ( ( a ,  b )  =>  new  Date ( b . updated )  -  new  Date ( a . updated ) ) ; 
4444  // Remove fallback runtime when we have breaking changes. 
45-   return  notebooks . map ( ( notebook )  =>  ( { ...notebook ,  runtime : DEFAULT_RUNTIME } ) ) ; 
45+   return  notebooks . map ( ( notebook )  =>  { 
46+     const  newNotebook  =  { ...notebook ,  runtime : DEFAULT_RUNTIME } ; 
47+     // Add fallback created timestamp. 
48+     if  ( ! newNotebook . created )  newNotebook . created  =  new  Date ( ) . toISOString ( ) ; 
49+     return  newNotebook ; 
50+   } ) ; 
4651} 
4752
4853export  function  clearNotebooksFromLocalStorage ( )  { 
@@ -72,6 +77,10 @@ export function addNotebook(notebook) {
7277export  function  saveNotebook ( notebook )  { 
7378  const  notebooks  =  getNotebooks ( ) ; 
7479  const  updatedNotebook  =  { ...notebook ,  updated : new  Date ( ) . toISOString ( ) } ; 
80+   // Prevent creating a new notebook if the created timestamp is not set. 
81+   if  ( ! updatedNotebook . created )  { 
82+     updatedNotebook . created  =  new  Date ( ) . toISOString ( ) ; 
83+   } 
7584  const  newNotebooks  =  notebooks . map ( ( f )  =>  ( f . id  ===  notebook . id  ? updatedNotebook  : f ) ) ; 
7685  saveNotebooks ( newNotebooks ) ; 
7786} 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments