dashboard bugfix - handle initial visit with no saved solutions

This commit is contained in:
Joshua Seigler 2025-05-19 16:45:55 -04:00
parent 48ae4d607e
commit a390bc7615

View file

@ -65,7 +65,7 @@ const colorStrings = [
export default function Dashboard() { export default function Dashboard() {
const { connections, store } = useAppModel(); const { connections, store } = useAppModel();
const nextUnsolvedId = createMemo(() => { const nextUnsolvedId = createMemo(() => {
return connections.find((x) => store.solutions[x.id] === undefined)?.id; return connections.find((x) => (store.solutions ?? [])[x.id] === undefined)?.id;
}); });
return ( return (
<div> <div>
@ -78,7 +78,7 @@ export default function Dashboard() {
<div class={styles.calendar}> <div class={styles.calendar}>
<For each={connections}> <For each={connections}>
{(item) => { {(item) => {
const isSolved = store.solutions[item.id] !== undefined; const isSolved = (store.solutions ?? [])[item.id] !== undefined;
const date = new Date(item.date); const date = new Date(item.date);
const showHeader = item.id === 1 || date.getDate() === 1; const showHeader = item.id === 1 || date.getDate() === 1;
return ( return (