mirror of
https://github.com/ilyakooo0/urbit.git
synced 2025-01-01 19:46:36 +03:00
groups-pane: refining loading strategy to be more efficient
This commit is contained in:
parent
65e05fbf25
commit
c3b491ddb0
@ -57,4 +57,13 @@ export async function bootstrapApi() {
|
||||
|
||||
useSettingsState.getState().getAll();
|
||||
gcpManager.start();
|
||||
|
||||
const {
|
||||
getKeys,
|
||||
getShallowChildren
|
||||
} = useGraphState.getState();
|
||||
|
||||
useHarkState.getState().getUnreads();
|
||||
getKeys();
|
||||
getShallowChildren(`~${window.ship}`, 'dm-inbox');
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ import { UnjoinedResource } from '~/views/components/UnjoinedResource';
|
||||
import { NewChannel } from './NewChannel';
|
||||
import { GroupHome } from './Home/GroupHome';
|
||||
import useGraphState from '~/logic/state/graph';
|
||||
import { deSig } from '@urbit/api';
|
||||
|
||||
interface GroupsPaneProps {
|
||||
baseUrl: string;
|
||||
@ -59,17 +60,27 @@ export function GroupsPane(props: GroupsPaneProps) {
|
||||
|
||||
useEffect(() => {
|
||||
const {
|
||||
graphs,
|
||||
graphKeys,
|
||||
getKeys,
|
||||
getShallowChildren
|
||||
} = useGraphState.getState();
|
||||
const dmGraph = graphs[`${deSig(window.ship)}/dm-inbox`];
|
||||
console.log(graphs, dmGraph);
|
||||
|
||||
useHarkState.getState().getUnreads();
|
||||
getKeys();
|
||||
if (graphKeys.size === 0) {
|
||||
getKeys();
|
||||
}
|
||||
|
||||
if (location.pathname.startsWith('/~landscape/messages')) {
|
||||
const { unreads, getUnreads } = useHarkState.getState();
|
||||
if (Object.keys(unreads).length === 0) {
|
||||
getUnreads();
|
||||
}
|
||||
|
||||
if (location.pathname.startsWith('/~landscape/messages') && !dmGraph) {
|
||||
getShallowChildren(`~${window.ship}`, 'dm-inbox');
|
||||
}
|
||||
}, []);
|
||||
}, [location]);
|
||||
|
||||
useEffect(() => {
|
||||
if (workspace.type !== 'group') {
|
||||
|
Loading…
Reference in New Issue
Block a user