Skip to content

Commit 58ac056

Browse files
committed
Fix null-check issues.
1 parent 5582445 commit 58ac056

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

demos/nextjs-supabase-todolist/src/app/views/todo-lists/edit/page.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ const TodoEditSection = () => {
5555
updatedRecord.completed_at = new Date().toISOString();
5656
updatedRecord.completed_by = userID;
5757
} else {
58-
updatedRecord.completed_at = undefined;
59-
updatedRecord.completed_by = undefined;
58+
updatedRecord.completed_at = null;
59+
updatedRecord.completed_by = null;
6060
}
6161
await powerSync.execute(
6262
`UPDATE ${TODOS_TABLE}
@@ -111,7 +111,7 @@ const TodoEditSection = () => {
111111
key={r.id}
112112
description={r.description}
113113
onDelete={() => deleteTodo(r.id)}
114-
isComplete={r.completed}
114+
isComplete={r.completed == 1}
115115
toggleCompletion={() => toggleCompletion(r, !r.completed)}
116116
/>
117117
))}

demos/nextjs-supabase-todolist/src/components/widgets/TodoItemWidget.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import CheckBoxOutlineBlankIcon from '@mui/icons-material/CheckBoxOutlineBlank';
66
import CheckBoxIcon from '@mui/icons-material/CheckBox';
77

88
export type TodoItemWidgetProps = {
9-
description: string;
9+
description: string | null;
1010
isComplete: boolean;
1111
onDelete: () => void;
1212
toggleCompletion: () => void;

demos/nextjs-supabase-todolist/src/components/widgets/TodoListsWidget.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export function TodoListsWidget(props: TodoListsWidgetProps) {
4242
{listRecords.map((r) => (
4343
<ListItemWidget
4444
key={r.id}
45-
title={r.name}
45+
title={r.name ?? ''}
4646
description={description(r.total_tasks, r.completed_tasks)}
4747
selected={r.id == props.selectedId}
4848
onDelete={() => deleteList(r.id)}

0 commit comments

Comments
 (0)