mirror of
https://github.com/stoatchat/for-legacy-web.git
synced 2026-03-06 17:11:55 +00:00
Finish migrating user state over to MobX.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { Reply } from "@styled-icons/boxicons-regular";
|
||||
import { File } from "@styled-icons/boxicons-solid";
|
||||
import { observer } from "mobx-react-lite";
|
||||
import { useHistory } from "react-router-dom";
|
||||
import { SYSTEM_USER_ID } from "revolt.js";
|
||||
import { Users } from "revolt.js/dist/api/objects";
|
||||
@@ -10,6 +11,8 @@ import { useLayoutEffect, useState } from "preact/hooks";
|
||||
|
||||
import { useRenderState } from "../../../../lib/renderer/Singleton";
|
||||
|
||||
import { useData } from "../../../../mobx/State";
|
||||
|
||||
import { useForceUpdate, useUser } from "../../../../context/revoltjs/hooks";
|
||||
import { mapMessage, MessageObject } from "../../../../context/revoltjs/util";
|
||||
|
||||
@@ -120,7 +123,7 @@ export const ReplyBase = styled.div<{
|
||||
`}
|
||||
`;
|
||||
|
||||
export function MessageReply({ index, channel, id }: Props) {
|
||||
export const MessageReply = observer(({ index, channel, id }: Props) => {
|
||||
const ctx = useForceUpdate();
|
||||
const view = useRenderState(channel);
|
||||
if (view?.type !== "RENDER") return null;
|
||||
@@ -152,7 +155,8 @@ export function MessageReply({ index, channel, id }: Props) {
|
||||
);
|
||||
}
|
||||
|
||||
const user = useUser(message.author, ctx);
|
||||
const store = useData();
|
||||
const user = store.users.get(message.author);
|
||||
const history = useHistory();
|
||||
|
||||
return (
|
||||
@@ -203,4 +207,4 @@ export function MessageReply({ index, channel, id }: Props) {
|
||||
)}
|
||||
</ReplyBase>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user