An easy-to-use platform for EEG experimentation in the classroom
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fixed errors with brittle file reading of previous experiments

+12 -12
+12 -12
app/components/HomeComponent/index.tsx
··· 52 52 kernelStatus: KERNEL_STATUS; 53 53 history: HashHistory; 54 54 JupyterActions: typeof JupyterActions; 55 - connectedDevice: object; 55 + connectedDevice: Record<string, unknown>; 56 56 signalQualityObservable: any | null | undefined; 57 57 deviceType: DEVICES; 58 58 deviceAvailability: DEVICE_AVAILABILITY; ··· 72 72 } 73 73 74 74 export default class Home extends Component<Props, State> { 75 - // handleLoadCustomExperiment: (string) => void; 76 - // handleOpenOverview: (EXPERIMENTS) => void; 77 - // handleCloseOverview: () => void; 78 - // handleDeleteWorkspace: (string) => void; 79 75 constructor(props: Props) { 80 76 super(props); 81 77 this.state = { ··· 203 199 <Table.Body className={styles.experimentTable}> 204 200 {this.state.recentWorkspaces 205 201 .sort((a, b) => { 206 - const aTime = 207 - readAndParseState(a).params.dateModified || 0; 208 - const bTime = 209 - readAndParseState(b).params.dateModified || 0; 202 + const aState = readAndParseState(a); 203 + const bState = readAndParseState(b); 204 + 205 + const aTime = aState?.params?.dateModified || 0; 206 + const bTime = bState?.params?.dateModified || 0; 207 + 210 208 return bTime - aTime; 211 209 }) 212 210 .map((dir) => { 213 - const { 214 - params: { dateModified }, 215 - } = readAndParseState(dir); 211 + const workspaceState = readAndParseState(dir); 212 + if (!workspaceState) { 213 + return undefined; 214 + } 215 + const dateModified = workspaceState.params?.dateModified; 216 216 return ( 217 217 <Table.Row key={dir} className={styles.experimentRow}> 218 218 <Table.Cell className={styles.experimentRowName}>