Bump revolt.js to fix objects not being properly updated.

Also don't re-fetch members on each message.
Add cursor: pointer to attachment images upon request.
Use client message cache for replies.
This commit is contained in:
Paul 2021-08-15 09:58:22 +01:00
parent f59d0efbcb
commit 4abf98adcb
5 changed files with 14 additions and 11 deletions

View file

@ -116,7 +116,7 @@
"react-virtuoso": "^1.10.4", "react-virtuoso": "^1.10.4",
"redux": "^4.1.0", "redux": "^4.1.0",
"revolt-api": "0.5.2-alpha.1", "revolt-api": "0.5.2-alpha.1",
"revolt.js": "5.0.1-alpha.3", "revolt.js": "5.0.1-alpha.5",
"rimraf": "^3.0.2", "rimraf": "^3.0.2",
"sass": "^1.35.1", "sass": "^1.35.1",
"shade-blend-color": "^1.0.0", "shade-blend-color": "^1.0.0",

View file

@ -89,3 +89,7 @@
.image { .image {
border-radius: var(--border-radius); border-radius: var(--border-radius);
} }
.image {
cursor: pointer;
}

View file

@ -144,11 +144,9 @@ export const MessageReply = observer(({ index, channel, id }: Props) => {
const [message, setMessage] = useState<Message | undefined>(undefined); const [message, setMessage] = useState<Message | undefined>(undefined);
useLayoutEffect(() => { useLayoutEffect(() => {
// ! FIXME: We should do this through the message renderer, so it can fetch it from cache if applicable. const message = channel.client.messages.get(id);
const m = view.messages.find((x) => x._id === id); if (message) {
setMessage(message);
if (m) {
setMessage(m);
} else { } else {
channel.fetchMessage(id).then(setMessage); channel.fetchMessage(id).then(setMessage);
} }

View file

@ -150,7 +150,8 @@ export const ServerMemberSidebar = observer(
if (status === ClientStatus.ONLINE) { if (status === ClientStatus.ONLINE) {
channel.server!.fetchMembers(); channel.server!.fetchMembers();
} }
}, [status, channel.server]); // eslint-disable-next-line
}, [status, channel.server_id]);
const keys = [...client.members.keys()]; const keys = [...client.members.keys()];
const entries = useEntries(channel, keys, true); const entries = useEntries(channel, keys, true);

View file

@ -3605,10 +3605,10 @@ revolt-api@0.5.2-alpha.1:
resolved "https://registry.yarnpkg.com/revolt-api/-/revolt-api-0.5.2-alpha.1.tgz#2164d04cd5581267ce59142557666bd386bc85c4" resolved "https://registry.yarnpkg.com/revolt-api/-/revolt-api-0.5.2-alpha.1.tgz#2164d04cd5581267ce59142557666bd386bc85c4"
integrity sha512-3OrjYCDNPkJ+yO9d87NJvuUDAbungEbUfrfHlvFwV8hJze/RMkuYUTFWe1HyBMwBC7F/yWQK+2V7IoifC5STmw== integrity sha512-3OrjYCDNPkJ+yO9d87NJvuUDAbungEbUfrfHlvFwV8hJze/RMkuYUTFWe1HyBMwBC7F/yWQK+2V7IoifC5STmw==
revolt.js@5.0.1-alpha.3: revolt.js@5.0.1-alpha.5:
version "5.0.1-alpha.3" version "5.0.1-alpha.5"
resolved "https://registry.yarnpkg.com/revolt.js/-/revolt.js-5.0.1-alpha.3.tgz#986d2ec21d751067d95c4f444f81b922df566cde" resolved "https://registry.yarnpkg.com/revolt.js/-/revolt.js-5.0.1-alpha.5.tgz#531f456cd80ca786868081825507b868e9eb8e27"
integrity sha512-h1xlaBvKyTS+wF9Oe4rtjuTe5plrOpYMp9qskqxMeNIoVu9VuJjHU+n9YUWANbgn7Ji9sxPHZrco5+0+bLOCcg== integrity sha512-D17O+MuCSL8KPehu2BoVb17/XgbtwGILMJPvBXyGUvbBuhOzieDAN2gzDCRNP17JvWR9kLkVOzXxWhCaBO36Vw==
dependencies: dependencies:
axios "^0.19.2" axios "^0.19.2"
eventemitter3 "^4.0.7" eventemitter3 "^4.0.7"