mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-01 03:23:09 +03:00
devex: address PR feedback
- move App#initSessions definition outside function component closure - enhance useAddSessions performance
This commit is contained in:
parent
d3f9d76217
commit
50d120e3c1
@ -21,18 +21,18 @@ import { DEFAULT_SESSION } from './constants';
|
||||
import { showSlog } from './lib/blit';
|
||||
import { InfoButton } from './InfoButton';
|
||||
|
||||
const initSessions = async () => {
|
||||
const response = await api.scry(scrySessions());
|
||||
|
||||
useTermState.getState().set((state) => {
|
||||
state.names = response.sort();
|
||||
});
|
||||
};
|
||||
|
||||
export default function TermApp() {
|
||||
const { names, selected } = useTermState();
|
||||
const dark = useDark();
|
||||
|
||||
const initSessions = useCallback(async () => {
|
||||
const response = await api.scry(scrySessions());
|
||||
|
||||
useTermState.getState().set((state) => {
|
||||
state.names = response.sort();
|
||||
});
|
||||
}, []);
|
||||
|
||||
const setupSlog = useCallback(() => {
|
||||
console.log('slog: setting up...');
|
||||
let available = false;
|
||||
|
@ -6,7 +6,7 @@ import { Icon } from '@tlon/indigo-react';
|
||||
|
||||
export const Tabs = () => {
|
||||
const { sessions, names } = useTermState();
|
||||
const { addSession } = useAddSession();
|
||||
const addSession = useAddSession();
|
||||
|
||||
return (
|
||||
<div className="tabs">
|
||||
|
@ -62,7 +62,5 @@ export const useAddSession = () => {
|
||||
}
|
||||
}, [names]);
|
||||
|
||||
return {
|
||||
addSession
|
||||
};
|
||||
return addSession;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user