Gracefully close the story viewer when we cannot find story
This commit is contained in:
parent
471a9e2e98
commit
e79380b37c
1 changed files with 11 additions and 10 deletions
|
@ -59,16 +59,6 @@ export function SmartStoryViewer(): JSX.Element | null {
|
|||
|
||||
const getStoryById = useSelector(getStoryByIdSelector);
|
||||
|
||||
const storyInfo = getStoryById(
|
||||
conversationSelector,
|
||||
selectedStoryData.messageId
|
||||
);
|
||||
strictAssert(
|
||||
storyInfo,
|
||||
'StoryViewer: selected story does not exist in stories'
|
||||
);
|
||||
const { conversationStory, distributionList, storyView } = storyInfo;
|
||||
|
||||
const recentEmojis = useRecentEmojis();
|
||||
const skinTone = useSelector<StateType, number>(getEmojiSkinTone);
|
||||
const replyState = useSelector(getStoryReplies);
|
||||
|
@ -81,6 +71,17 @@ export function SmartStoryViewer(): JSX.Element | null {
|
|||
getHasReadReceiptSetting
|
||||
);
|
||||
|
||||
const storyInfo = getStoryById(
|
||||
conversationSelector,
|
||||
selectedStoryData.messageId
|
||||
);
|
||||
|
||||
if (!storyInfo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const { conversationStory, distributionList, storyView } = storyInfo;
|
||||
|
||||
return (
|
||||
<StoryViewer
|
||||
currentIndex={selectedStoryData.currentIndex}
|
||||
|
|
Loading…
Reference in a new issue