Skip to content

Commit

Permalink
Merge pull request #285 from cabcookie:fix-blocks-with-missing-todos
Browse files Browse the repository at this point in the history
fix: blocks with missing todos
  • Loading branch information
cabcookie authored Feb 20, 2025
2 parents bc39b9b + 4f2ed67 commit 5fc8dfe
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
11 changes: 6 additions & 5 deletions api/useMeetings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ import {
toISODateString,
} from "@/helpers/functional";
import { SelectionSet, generateClient } from "aws-amplify/data";
import { flow } from "lodash";
import { get, map, some, sortBy, uniq } from "lodash/fp";
import { flow, get, map, some, sortBy, uniq } from "lodash/fp";
import { useEffect, useState } from "react";
import useSWR from "swr";
import { handleApiErrors } from "./globals";
Expand Down Expand Up @@ -173,10 +172,12 @@ const fetchMeetingsWithToken: FetchMeetingsWithTokenFunction = async ({

const fetchMeetings = (startDate: string, context?: Context) => async () => {
if (!context) return;
const meetings = await fetchMeetingsWithToken({ startDate, context });
try {
return (await fetchMeetingsWithToken({ startDate, context }))
?.map(mapMeeting)
.sort((a, b) => b.meetingOn.getTime() - a.meetingOn.getTime());
return flow(
map(mapMeeting),
sortBy((m) => -m.meetingOn.getTime())
)(meetings);
} catch (error) {
console.error("fetchMeetings", { error });
throw error;
Expand Down
6 changes: 4 additions & 2 deletions components/ui-elements/editors/helpers/transform-v3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ const mapListItem = (
);
};

const mapTodoBlock = (block: NoteBlockData): JSONContent => {
const mapTodoBlock = (block: NoteBlockData): JSONContent | undefined => {
if (!block.todo?.id || !block.todo?.todo) return;
const content: JSONContent = JSON.parse(block.todo.todo as any);
return {
...content,
Expand All @@ -81,10 +82,11 @@ const mapBlocks =
(prev: JSONContent[], blockId: string): JSONContent[] => {
const block = noteBlocks.find((block) => block.id === blockId);
if (!block) return prev;
const content: JSONContent =
const content: JSONContent | undefined =
block.type === "taskItem"
? mapTodoBlock(block)
: JSON.parse(block.content as any);
if (!content) return prev;
if (content.type === "listItemOrdered")
return mapListItem(
"orderedList",
Expand Down
8 changes: 2 additions & 6 deletions docs/releases/next.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
# Optionale Schritte in der Wochenplanung (Version :VERSION)

- Das Leeren der Inbox kann nun in der Wochenplanung übersprungen werden.
- Das Aktualisieren der Finanzdaten kann nun in der Wochenplanung übersprungen werden.
- Das Aktualisieren der CRM Projekte kann nun in der Wochenplanung übersprungen werden.
# Meetings wurden nicht angezeigt (Version :VERSION)

## Fehlerbehebungen

- Bei Gelerntem zu Kunden und Personen erscheint die erste Zeile nun unter der Menüleiste und ist nicht mehr von dieser abgedeckt.
Es konnte passieren, dass die Verknüpfung zwischen dem Abschnitt einer Notiz und einer Aufgabe verloren ging. Das hatte zur Konsequenz, dass die Meetingliste nicht mehr angezeigt werden konnte. Wenn diese Verknüpfung verloren gegangen ist, ignorieren wir den Abschnitt jetzt und sehen ihn nicht mehr vor.

## Bekannte Fehler

Expand Down

0 comments on commit 5fc8dfe

Please sign in to comment.