@@ -39,7 +39,7 @@ function HomeTabRecentWorkspaces({ plugin }: HomeTabFileProps) {
39
39
if ( ! recents ) {
40
40
newRecents = [ ]
41
41
} else {
42
- newRecents = recents . filter ( ( el ) => typeof el === 'string' ? el !== name : el . name !== name )
42
+ newRecents = recents . filter ( ( el ) => ( el || { } ) . name ? el . name !== name : el !== name )
43
43
localStorage . setItem ( 'recentWorkspaces' , JSON . stringify ( newRecents ) )
44
44
}
45
45
setState ( ( prevState ) => {
@@ -100,15 +100,15 @@ function HomeTabRecentWorkspaces({ plugin }: HomeTabFileProps) {
100
100
</ label >
101
101
< div className = "d-flex flex-column pl-2" >
102
102
{
103
- Array . isArray ( state . recentWorkspaces ) && state . recentWorkspaces . map ( ( workspace , index ) => {
104
- const workspaceName = typeof workspace === 'string' ? workspace : workspace . name
105
- const workspaceTimestamp = typeof workspace === 'string' ? null : workspace . timestamp
103
+ Array . isArray ( state . recentWorkspaces ) && state . recentWorkspaces . map ( ( workspace : any , index ) => {
104
+ const workspaceName = ( workspace || { } ) . name ? workspace . name : workspace
105
+ const workspaceTimestamp = ( workspace || { } ) . timestamp ? workspace . timestamp : null
106
106
107
107
return index < 3 ? (
108
108
< div key = { index } className = "d-flex flex-row align-items-center mb-2" >
109
109
{ loadingWorkspace === workspace ? < i className = "fad fa-spinner fa-spin mr-2" > </ i > : < i className = "fas fa-folder-tree mr-2" > </ i > }
110
110
< div className = "d-flex flex-row justify-content-between w-100 flex-wrap" >
111
- < a className = "cursor-pointer text-decoration-none d-inline-block" href = "#" onClick = { ( e ) => handleSwitchToRecentWorkspace ( e , workspace ) } key = { index } >
111
+ < a className = "cursor-pointer text-decoration-none d-inline-block" href = "#" onClick = { ( e ) => handleSwitchToRecentWorkspace ( e , workspaceName ) } key = { index } >
112
112
< span style = { { color : isDark ? 'white' : 'black' } } > { workspaceName } </ span >
113
113
</ a >
114
114
< span className = "text-muted" > created { getTimeAgo ( workspaceTimestamp ) } </ span >
0 commit comments