this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Possibly fix sometimes the Profile menu becomes missing

+13 -6
+13 -6
src/components/nav-menu.jsx
··· 1 1 import './nav-menu.css'; 2 2 3 3 import { ControlledMenu, MenuDivider, MenuItem } from '@szhsin/react-menu'; 4 - import { useRef, useState } from 'preact/hooks'; 4 + import { useEffect, useRef, useState } from 'preact/hooks'; 5 5 import { useLongPress } from 'use-long-press'; 6 6 import { useSnapshot } from 'valtio'; 7 7 ··· 16 16 function NavMenu(props) { 17 17 const snapStates = useSnapshot(states); 18 18 const { instance, authenticated } = api(); 19 - const accounts = store.local.getJSON('accounts') || []; 20 - const currentAccount = accounts.find( 21 - (account) => account.info.id === store.session.get('currentAccount'), 22 - ); 23 - const moreThanOneAccount = accounts.length > 1; 19 + 20 + const [currentAccount, setCurrentAccount] = useState(); 21 + const [moreThanOneAccount, setMoreThanOneAccount] = useState(false); 22 + 23 + useEffect(() => { 24 + const accounts = store.local.getJSON('accounts') || []; 25 + const acc = accounts.find( 26 + (account) => account.info.id === store.session.get('currentAccount'), 27 + ); 28 + if (acc) setCurrentAccount(acc); 29 + setMoreThanOneAccount(accounts.length > 1); 30 + }, []); 24 31 25 32 // Home = Following 26 33 // But when in multi-column mode, Home becomes columns of anything