File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change 99import * as LIT from 'types/generated/lit-sessions_pb' ;
1010import { IS_PROD } from 'config' ;
1111import copyToClipboard from 'copy-to-clipboard' ;
12+ import { MAX_DATE } from 'util/constants' ;
1213import { hex } from 'util/strings' ;
1314import { Store } from 'store' ;
1415import { Session } from '../models' ;
@@ -70,6 +71,15 @@ export default class SessionStore {
7071
7172 this . _store . log . info ( 'updated sessionStore.sessions' , toJS ( this . sessions ) ) ;
7273 } ) ;
74+
75+ // Ensures that there is at least one session created
76+ if ( this . sortedSessions . length === 0 ) {
77+ const count = values ( this . sessions ) . filter ( s =>
78+ s . label . startsWith ( 'Default Session' ) ,
79+ ) . length ;
80+ const countText = count === 0 ? '' : `(${ count } )` ;
81+ await this . addSession ( `Default Session ${ countText } ` , MAX_DATE ) ;
82+ }
7383 } catch ( error ) {
7484 this . _store . appView . handleError ( error , 'Unable to fetch sessions' ) ;
7585 }
You can’t perform that action at this time.
0 commit comments