diff --git a/src/sidebar/components/ShareDialog/ExportAnnotations.tsx b/src/sidebar/components/ShareDialog/ExportAnnotations.tsx index 58af4b4be62..681d239b86c 100644 --- a/src/sidebar/components/ShareDialog/ExportAnnotations.tsx +++ b/src/sidebar/components/ShareDialog/ExportAnnotations.tsx @@ -60,7 +60,7 @@ function ExportAnnotations({ const defaultFilename = useMemo( () => suggestedFilename({ - documentMetadata: contentFrame.metadata, + documentMetadata: contentFrame?.metadata, groupName: group?.name, }), [contentFrame, group], diff --git a/src/sidebar/store/modules/frames.ts b/src/sidebar/store/modules/frames.ts index f2678947364..b5c613a9fdf 100644 --- a/src/sidebar/store/modules/frames.ts +++ b/src/sidebar/store/modules/frames.ts @@ -163,7 +163,16 @@ const mainFrame = createSelector( */ const defaultContentFrame = createSelector( (state: State) => state.frames, - frames => firstFrameWithoutId(frames) ?? frames[0] ?? null, + frames => { + const mainFrame = firstFrameWithoutId(frames); + if (mainFrame) { + return mainFrame; + } else if (frames.length > 0) { + return frames[0]; + } else { + return null; + } + }, ); function searchUrisForFrame(frame: Frame): string[] {