mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-11-10 10:05:09 +03:00
bootstrap: moving data calls to relevant component so it always loads
This commit is contained in:
parent
687b23e519
commit
9b59f26c6c
@ -34,23 +34,6 @@ export async function bootstrapApi() {
|
||||
|
||||
await useMetadataState.getState().initialize(airlock);
|
||||
|
||||
const path = window.location.pathname;
|
||||
const inGroup = path.startsWith('/apps/landscape/~landscape/ship');
|
||||
const inDms = path.startsWith('/apps/landscape/~landscape/messages');
|
||||
const {
|
||||
getKeys,
|
||||
getShallowChildren
|
||||
} = useGraphState.getState();
|
||||
|
||||
if (inDms) {
|
||||
getShallowChildren(`~${window.ship}`, 'dm-inbox');
|
||||
}
|
||||
|
||||
if (inGroup || inDms) {
|
||||
getKeys();
|
||||
useHarkState.getState().getUnreads();
|
||||
}
|
||||
|
||||
const subs = [
|
||||
useGroupState,
|
||||
useContactState,
|
||||
|
@ -4,7 +4,7 @@ import Helmet from 'react-helmet';
|
||||
import { Box } from '@tlon/indigo-react';
|
||||
import {
|
||||
Route,
|
||||
RouteComponentProps, Switch
|
||||
RouteComponentProps, Switch, useLocation
|
||||
} from 'react-router-dom';
|
||||
import { useShortcut } from '~/logic/state/settings';
|
||||
import { useLocalStorageState } from '~/logic/lib/useLocalStorageState';
|
||||
@ -26,6 +26,7 @@ import { DmResource } from '~/views/apps/chat/DmResource';
|
||||
import { UnjoinedResource } from '~/views/components/UnjoinedResource';
|
||||
import { NewChannel } from './NewChannel';
|
||||
import { GroupHome } from './Home/GroupHome';
|
||||
import useGraphState from '~/logic/state/graph';
|
||||
|
||||
interface GroupsPaneProps {
|
||||
baseUrl: string;
|
||||
@ -34,6 +35,7 @@ interface GroupsPaneProps {
|
||||
|
||||
export function GroupsPane(props: GroupsPaneProps) {
|
||||
const { baseUrl, workspace } = props;
|
||||
const location = useLocation();
|
||||
const associations = useMetadataState(state => state.associations);
|
||||
const notificationsCount = useHarkState(state => state.notificationsCount);
|
||||
|
||||
@ -55,6 +57,20 @@ export function GroupsPane(props: GroupsPaneProps) {
|
||||
[]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
const {
|
||||
getKeys,
|
||||
getShallowChildren
|
||||
} = useGraphState.getState();
|
||||
|
||||
useHarkState.getState().getUnreads();
|
||||
getKeys();
|
||||
|
||||
if (location.pathname.startsWith('/~landscape/messages')) {
|
||||
getShallowChildren(`~${window.ship}`, 'dm-inbox');
|
||||
}
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (workspace.type !== 'group') {
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user