Skip to content

Commit

Permalink
Fix loadMachine to default to empty cell types list
Browse files Browse the repository at this point in the history
Fixes a bug where old project zips, for example, would crash because no cellTypes.json is inside the zip file loaded on the front end
  • Loading branch information
ykevu committed Jan 27, 2023
1 parent f9d0729 commit dd3cca3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion frontend/src/Project/service/loadMachine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,13 @@ const createLoadMachine = (projectId: string) =>
}),
'set cellTypes': assign({
// @ts-ignore
cellTypes: (context, event) => event.data.files['cellTypes.json'] as CellTypes,
cellTypes: (context, event) => {
const cellTypes = event.data.files['cellTypes.json'] as CellTypes;
if (cellTypes) {
return cellTypes;
}
return [];
},
}),
'set metadata': assign((ctx, evt) => {
// @ts-ignore
Expand Down

0 comments on commit dd3cca3

Please sign in to comment.