Sticker Set Modal: Prevent exception when missing sticker set
This commit is contained in:
parent
5a23d30a21
commit
fc61b38b88
@ -61,7 +61,7 @@ const StickerSetModal: FC<OwnProps & StateProps & DispatchProps> = ({
|
||||
stickerSetId,
|
||||
stickerSetAccessHash,
|
||||
});
|
||||
} else {
|
||||
} else if (stickerSetShortName) {
|
||||
loadStickers({
|
||||
stickerSetShortName,
|
||||
});
|
||||
@ -134,7 +134,9 @@ export default memo(withGlobal(
|
||||
return {
|
||||
stickerSet: fromSticker
|
||||
? selectStickerSet(global, fromSticker.stickerSetId)
|
||||
: selectStickerSetByShortName(global, stickerSetShortName!),
|
||||
: stickerSetShortName
|
||||
? selectStickerSetByShortName(global, stickerSetShortName)
|
||||
: undefined,
|
||||
};
|
||||
},
|
||||
(setGlobal, actions): DispatchProps => pick(actions, [
|
||||
|
||||
@ -214,6 +214,10 @@ const Main: FC<StateProps & DispatchProps> = ({
|
||||
updateIcon(false);
|
||||
}, [updateIsOnline]);
|
||||
|
||||
const handleStickerSetModalClose = useCallback(() => {
|
||||
openStickerSetShortName({ stickerSetShortName: undefined });
|
||||
}, [openStickerSetShortName]);
|
||||
|
||||
// Online status and browser tab indicators
|
||||
useBackgroundMode(handleBlur, handleFocus);
|
||||
useBeforeUnload(handleBlur);
|
||||
@ -236,8 +240,8 @@ const Main: FC<StateProps & DispatchProps> = ({
|
||||
<SafeLinkModal url={safeLinkModalUrl} />
|
||||
<HistoryCalendar isOpen={isHistoryCalendarOpen} />
|
||||
<StickerSetModal
|
||||
isOpen={!!openedStickerSetShortName}
|
||||
onClose={() => openStickerSetShortName({ stickerSetShortName: undefined })}
|
||||
isOpen={Boolean(openedStickerSetShortName)}
|
||||
onClose={handleStickerSetModalClose}
|
||||
stickerSetShortName={openedStickerSetShortName}
|
||||
/>
|
||||
</div>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user