[Refactoring] Get rid of redundant requests
This commit is contained in:
parent
559c1c80dd
commit
b80a1e0ee9
@ -128,31 +128,39 @@ const Main: FC<StateProps & DispatchProps> = ({
|
|||||||
loadNotificationSettings();
|
loadNotificationSettings();
|
||||||
loadNotificationExceptions();
|
loadNotificationExceptions();
|
||||||
loadTopInlineBots();
|
loadTopInlineBots();
|
||||||
|
|
||||||
loadEmojiKeywords({ language: BASE_EMOJI_KEYWORD_LANG });
|
loadEmojiKeywords({ language: BASE_EMOJI_KEYWORD_LANG });
|
||||||
|
}
|
||||||
|
}, [
|
||||||
|
lastSyncTime, loadAnimatedEmojis, loadEmojiKeywords, loadNotificationExceptions, loadNotificationSettings,
|
||||||
|
loadTopInlineBots, updateIsOnline,
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Language-based API calls
|
||||||
|
useEffect(() => {
|
||||||
|
if (lastSyncTime) {
|
||||||
if (language !== BASE_EMOJI_KEYWORD_LANG) {
|
if (language !== BASE_EMOJI_KEYWORD_LANG) {
|
||||||
loadEmojiKeywords({ language });
|
loadEmojiKeywords({ language });
|
||||||
}
|
}
|
||||||
|
|
||||||
loadCountryList({ langCode: language });
|
loadCountryList({ langCode: language });
|
||||||
}
|
}
|
||||||
}, [
|
}, [language, lastSyncTime, loadCountryList, loadEmojiKeywords]);
|
||||||
lastSyncTime, loadAnimatedEmojis, loadNotificationExceptions, loadNotificationSettings, updateIsOnline,
|
|
||||||
loadTopInlineBots, loadEmojiKeywords, loadCountryList, language,
|
|
||||||
]);
|
|
||||||
|
|
||||||
|
// Check version when service chat is ready
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (lastSyncTime && isServiceChatReady) {
|
if (lastSyncTime && isServiceChatReady) {
|
||||||
checkVersionNotification();
|
checkVersionNotification();
|
||||||
}
|
}
|
||||||
}, [lastSyncTime, isServiceChatReady, checkVersionNotification]);
|
}, [lastSyncTime, isServiceChatReady, checkVersionNotification]);
|
||||||
|
|
||||||
|
// Ensure time format
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (lastSyncTime && !wasTimeFormatSetManually) {
|
if (lastSyncTime && !wasTimeFormatSetManually) {
|
||||||
ensureTimeFormat();
|
ensureTimeFormat();
|
||||||
}
|
}
|
||||||
}, [lastSyncTime, wasTimeFormatSetManually, ensureTimeFormat]);
|
}, [lastSyncTime, wasTimeFormatSetManually, ensureTimeFormat]);
|
||||||
|
|
||||||
|
// Parse deep link
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (lastSyncTime && LOCATION_HASH.startsWith('#?tgaddr=')) {
|
if (lastSyncTime && LOCATION_HASH.startsWith('#?tgaddr=')) {
|
||||||
processDeepLink(decodeURIComponent(LOCATION_HASH.substr('#?tgaddr='.length)));
|
processDeepLink(decodeURIComponent(LOCATION_HASH.substr('#?tgaddr='.length)));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user