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
+8 -4
View File
@@ -21,13 +21,17 @@ export const setSettings = (settings: Settings) => {
// App-specific actions
export const setDone = (list: TodoListItem, item: ListItem, done: boolean) => {
export const setDone = (
list: TodoListItem,
listItem: ListItem,
done: boolean,
) => {
Store.update((s, o) => {
const listIndex = o.lists.findIndex(l => l === list);
const items = o.lists[listIndex].items;
if(!items) return;
const itemIndex = items.findIndex(i => i === item);
const item = items[itemIndex];
const itemIndex = items?.findIndex(i => i === listItem);
const item = items?.[itemIndex ?? -1];
if (!item) return;
item.done = done;
if (list === o.selectedList) {
s.selectedList = s.lists[listIndex];