forked from abner/for-legacy-web
Load member sidebar into MobX state.
This commit is contained in:
@@ -8,13 +8,13 @@ import { useContext, useEffect, useMemo, useState } from "preact/hooks";
|
||||
|
||||
import { SingletonMessageRenderer } from "../../lib/renderer/Singleton";
|
||||
|
||||
import { useData } from "../../mobx/State";
|
||||
import { dispatch } from "../../redux";
|
||||
import { connectState } from "../../redux/connector";
|
||||
import { AuthState } from "../../redux/reducers/auth";
|
||||
|
||||
import Preloader from "../../components/ui/Preloader";
|
||||
|
||||
import { useData } from "../../mobx/State";
|
||||
import { Children } from "../../types/Preact";
|
||||
import { useIntermediate } from "../intermediate/Intermediate";
|
||||
import { registerEvents, setReconnectDisallowed } from "./events";
|
||||
@@ -158,10 +158,9 @@ function Context({ auth, children }: Props) {
|
||||
};
|
||||
}, [client, auth.active]);
|
||||
|
||||
const store = useData();
|
||||
useEffect(
|
||||
() => registerEvents({ operations }, setStatus, client, store),
|
||||
[client, store],
|
||||
() => registerEvents({ operations }, setStatus, client),
|
||||
[client],
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@@ -3,10 +3,10 @@ import { ClientboundNotification } from "revolt.js/dist/websocket/notifications"
|
||||
|
||||
import { StateUpdater } from "preact/hooks";
|
||||
|
||||
import { dispatch } from "../../redux";
|
||||
|
||||
import { DataStore } from "../../mobx";
|
||||
import { useData } from "../../mobx/State";
|
||||
import { dispatch } from "../../redux";
|
||||
|
||||
import { ClientOperations, ClientStatus } from "./RevoltClient";
|
||||
|
||||
export var preventReconnect = false;
|
||||
@@ -20,7 +20,6 @@ export function registerEvents(
|
||||
{ operations }: { operations: ClientOperations },
|
||||
setStatus: StateUpdater<ClientStatus>,
|
||||
client: Client,
|
||||
store: DataStore,
|
||||
) {
|
||||
function attemptReconnect() {
|
||||
if (preventReconnect) return;
|
||||
@@ -48,7 +47,6 @@ export function registerEvents(
|
||||
},
|
||||
|
||||
packet: (packet: ClientboundNotification) => {
|
||||
store.packet(packet);
|
||||
switch (packet.type) {
|
||||
case "ChannelStartTyping": {
|
||||
if (packet.user === client.user?._id) return;
|
||||
|
||||
Reference in New Issue
Block a user