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 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 recentEmojis = useRecentEmojis();
|
||||||
const skinTone = useSelector<StateType, number>(getEmojiSkinTone);
|
const skinTone = useSelector<StateType, number>(getEmojiSkinTone);
|
||||||
const replyState = useSelector(getStoryReplies);
|
const replyState = useSelector(getStoryReplies);
|
||||||
|
@ -81,6 +71,17 @@ export function SmartStoryViewer(): JSX.Element | null {
|
||||||
getHasReadReceiptSetting
|
getHasReadReceiptSetting
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const storyInfo = getStoryById(
|
||||||
|
conversationSelector,
|
||||||
|
selectedStoryData.messageId
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!storyInfo) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const { conversationStory, distributionList, storyView } = storyInfo;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StoryViewer
|
<StoryViewer
|
||||||
currentIndex={selectedStoryData.currentIndex}
|
currentIndex={selectedStoryData.currentIndex}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue