Update logic to listen for a restoration completion event
This commit is contained in:
parent
f558bc880a
commit
c8ecbe6e79
9 changed files with 68 additions and 48 deletions
|
@ -6,6 +6,7 @@ import { bytesToHuman, megabytesToHuman } from '@/helpers';
|
|||
import TitledGreyBox from '@/components/elements/TitledGreyBox';
|
||||
import { ServerContext } from '@/state/server';
|
||||
import CopyOnClick from '@/components/elements/CopyOnClick';
|
||||
import { SocketEvent, SocketRequest } from '@/components/server/events';
|
||||
|
||||
interface Stats {
|
||||
memory: number;
|
||||
|
@ -55,11 +56,11 @@ const ServerDetailsBlock = () => {
|
|||
return;
|
||||
}
|
||||
|
||||
instance.addListener('stats', statsListener);
|
||||
instance.send('send stats');
|
||||
instance.addListener(SocketEvent.STATS, statsListener);
|
||||
instance.send(SocketRequest.SEND_STATS);
|
||||
|
||||
return () => {
|
||||
instance.removeListener('stats', statsListener);
|
||||
instance.removeListener(SocketEvent.STATS, statsListener);
|
||||
};
|
||||
}, [ instance, connected ]);
|
||||
|
||||
|
|
Reference in a new issue