diff --git a/src/renderer/src/components/SlateImporter.tsx b/src/renderer/src/components/SlateImporter.tsx index 86a2fa9..d327b92 100644 --- a/src/renderer/src/components/SlateImporter.tsx +++ b/src/renderer/src/components/SlateImporter.tsx @@ -184,26 +184,6 @@ export default function SlateImporter() { )} )} -{/* - {createNote && ( - - {(provided, snapshot) => ( -
- <> - - - {provided.placeholder} -
- )} -
- )} */} ); } diff --git a/src/renderer/src/context/context.tsx b/src/renderer/src/context/context.tsx index c1e3da5..a46fb25 100644 --- a/src/renderer/src/context/context.tsx +++ b/src/renderer/src/context/context.tsx @@ -176,6 +176,13 @@ export const SlateDataContext = createContext({ importerFiles: [], }); +function scrubNulls(cols: SlateColumn[]) { + return cols.filter(c => c !== null).map(c => { + c.cards = c.cards.filter(card => card !== null); + return c + }) +} + export function SlateDataProvider(props: PropsWithChildren) { const { children } = props; const KEY = "slate_cols"; @@ -183,7 +190,7 @@ export function SlateDataProvider(props: PropsWithChildren) { const [data, dispatch] = useImmerReducer( slateDataReducer, { - columns: window.electronStore.get(KEY) || [], + columns: scrubNulls(window.electronStore.get(KEY) || []), importerFiles: [], } ); @@ -194,7 +201,7 @@ export function SlateDataProvider(props: PropsWithChildren) { if (newValue[KEY]) { dispatch({ type: "set_columns", - newColumns: newValue[KEY] as SlateColumn[], + newColumns: scrubNulls(newValue[KEY] as SlateColumn[]), }); } }