Fix for dynamic routes with app router SSR

This commit is contained in:
Nathan Chapman
2024-03-07 11:36:12 -06:00
parent 83ede65b5e
commit 9d8c110044
18 changed files with 327 additions and 229 deletions
+15 -7
View File
@@ -22,7 +22,7 @@ type ListDetailParams = {
listId: string;
};
const ListItems = ({ list }: {list: TodoListItem}) => {
const ListItems = ({ list }: { list: TodoListItem }) => {
return (
<IonList>
{(list?.items || []).map((item, key) => (
@@ -32,10 +32,20 @@ const ListItems = ({ list }: {list: TodoListItem}) => {
);
};
const ListItemEntry = ({ list, item }: {list: TodoListItem, item: ListItem}) => (
const ListItemEntry = ({
list,
item,
}: {
list: TodoListItem;
item: ListItem;
}) => (
<IonItem onClick={() => actions.setDone(list, item, !item.done)}>
<IonLabel>{item.name}</IonLabel>
<IonCheckbox checked={item.done || false} slot="end" />
<IonCheckbox
aria-label={item.name}
checked={item.done || false}
slot="end"
/>
</IonItem>
);
@@ -50,14 +60,12 @@ const ListDetail = () => {
<IonHeader>
<IonToolbar>
<IonButtons slot="start">
<IonBackButton defaultHref="/tabs/lists" />
<IonBackButton defaultHref="/lists" />
</IonButtons>
<IonTitle>{loadedList?.name}</IonTitle>
</IonToolbar>
</IonHeader>
<IonContent>
{loadedList && <ListItems list={loadedList} />}
</IonContent>
<IonContent>{loadedList && <ListItems list={loadedList} />}</IonContent>
</IonPage>
);
};