Fix wait for prefs on default channel set

This commit is contained in:
Rafael 2022-05-25 12:42:44 -03:00 committed by Thomas Zarebczan
parent 1dccc1ac64
commit 11bdb6a872

View file

@ -160,7 +160,6 @@ function App(props: Props) {
const hasMyChannels = myChannelClaimIds && myChannelClaimIds.length > 0; const hasMyChannels = myChannelClaimIds && myChannelClaimIds.length > 0;
const hasNoChannels = myChannelClaimIds && myChannelClaimIds.length === 0; const hasNoChannels = myChannelClaimIds && myChannelClaimIds.length === 0;
const shouldMigrateLanguage = LANGUAGE_MIGRATIONS[language]; const shouldMigrateLanguage = LANGUAGE_MIGRATIONS[language];
const hasActiveChannelClaim = activeChannelClaim !== undefined;
const renderFiledrop = !isMobile && isAuthenticated; const renderFiledrop = !isMobile && isAuthenticated;
const connectionStatus = useConnectionStatus(); const connectionStatus = useConnectionStatus();
@ -343,10 +342,15 @@ function App(props: Props) {
if (hasMyChannels) { if (hasMyChannels) {
fetchModBlockedList(); fetchModBlockedList();
fetchModAmIList(); fetchModAmIList();
if (activeChannelClaim && !defaultChannelClaim) doSetDefaultChannel(activeChannelClaim.claim_id);
} }
// eslint-disable-next-line react-hooks/exhaustive-deps // eslint-disable-next-line react-hooks/exhaustive-deps
}, [hasMyChannels, hasNoChannels, hasActiveChannelClaim, setIncognito]); }, [hasMyChannels, hasNoChannels, setIncognito]);
useEffect(() => {
if (hasMyChannels && activeChannelClaim && !defaultChannelClaim && prefsReady) {
doSetDefaultChannel(activeChannelClaim.claim_id);
}
}, [activeChannelClaim, defaultChannelClaim, doSetDefaultChannel, hasMyChannels, prefsReady]);
useEffect(() => { useEffect(() => {
// $FlowFixMe // $FlowFixMe