Skip to content

Commit 8069ae9

Browse files
committed
fix: strictNullChecks on bookmark.name which can be undefined
1 parent b99321a commit 8069ae9

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/common/redux/states/bookmark.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export type TBookmarkState = TPQueueState<number, IBookmarkState>;
1313

1414
export interface IBookmarkState {
1515
uuid: string;
16-
name: string;
16+
name: string | undefined;
1717
index: number;
1818

1919
locatorExtended: MiniLocatorExtended,

src/renderer/reader/components/BookmarkEdit.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ import { BookmarkLocatorInfo } from "./BookmarkLocatorInfo";
1919
import { MiniLocatorExtended } from "readium-desktop/common/redux/states/locatorInitialState";
2020

2121
interface IProps {
22-
toggleBookmark: (name?: string) => void,
22+
toggleBookmark: (name: string) => void,
2323
cancel?: () => void;
2424
uuid?: string;
2525
dockedMode?: boolean;
26-
name: string;
26+
name: string | undefined;
2727
locatorExtended: MiniLocatorExtended;
2828
}
2929

src/renderer/reader/redux/sagas/note.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,10 @@ function* bookmarkPush(action: readerActions.bookmark.push.TAction) {
186186
cfi: undefined,
187187
},
188188
cleanBefore: bookmark.locatorExtended.locator.locations.caretInfo?.cleanBefore || bookmark.locatorExtended.locator.text?.before || "",
189-
cleanText: bookmark.locatorExtended.locator.locations.caretInfo?.cleanText || bookmark.locatorExtended.locator.text?.highlight || bookmark.locatorExtended.locator.title || bookmark.name,
189+
cleanText: bookmark.locatorExtended.locator.locations.caretInfo?.cleanText || bookmark.locatorExtended.locator.text?.highlight || bookmark.locatorExtended.locator.title || bookmark.name || "",
190190
cleanAfter: bookmark.locatorExtended.locator.locations.caretInfo?.cleanAfter || bookmark.locatorExtended.locator.text?.after || "",
191191
rawBefore: bookmark.locatorExtended.locator.locations.caretInfo?.rawBefore || bookmark.locatorExtended.locator.text?.beforeRaw || "",
192-
rawText: bookmark.locatorExtended.locator.locations.caretInfo?.rawText || bookmark.locatorExtended.locator.text?.highlightRaw || bookmark.locatorExtended.locator.title || bookmark.name,
192+
rawText: bookmark.locatorExtended.locator.locations.caretInfo?.rawText || bookmark.locatorExtended.locator.text?.highlightRaw || bookmark.locatorExtended.locator.title || bookmark.name || "",
193193
rawAfter: bookmark.locatorExtended.locator.locations.caretInfo?.rawAfter || bookmark.locatorExtended.locator.text?.afterRaw || "",
194194
},
195195
color: {red: 52, green: 152, blue: 219},
@@ -474,10 +474,10 @@ function* readerStart() {
474474
cfi: undefined,
475475
},
476476
cleanBefore: bookmark.locatorExtended.locator.locations.caretInfo?.cleanBefore || bookmark.locatorExtended.locator.text?.before || "",
477-
cleanText: bookmark.locatorExtended.locator.locations.caretInfo?.cleanText || bookmark.locatorExtended.locator.text?.highlight || bookmark.locatorExtended.locator.title || bookmark.name,
477+
cleanText: bookmark.locatorExtended.locator.locations.caretInfo?.cleanText || bookmark.locatorExtended.locator.text?.highlight || bookmark.locatorExtended.locator.title || bookmark.name || "",
478478
cleanAfter: bookmark.locatorExtended.locator.locations.caretInfo?.cleanAfter || bookmark.locatorExtended.locator.text?.after || "",
479479
rawBefore: bookmark.locatorExtended.locator.locations.caretInfo?.rawBefore || bookmark.locatorExtended.locator.text?.beforeRaw || "",
480-
rawText: bookmark.locatorExtended.locator.locations.caretInfo?.rawText || bookmark.locatorExtended.locator.text?.highlightRaw || bookmark.locatorExtended.locator.title || bookmark.name,
480+
rawText: bookmark.locatorExtended.locator.locations.caretInfo?.rawText || bookmark.locatorExtended.locator.text?.highlightRaw || bookmark.locatorExtended.locator.title || bookmark.name || "",
481481
rawAfter: bookmark.locatorExtended.locator.locations.caretInfo?.rawAfter || bookmark.locatorExtended.locator.text?.afterRaw || "",
482482
},
483483
color: {red: 52, green: 152, blue: 219},

0 commit comments

Comments
 (0)