mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-13 18:59:22 -05:00
fix: finally fix the members sidebar (real)
This commit is contained in:
parent
00764b8cc3
commit
a09fbe685d
1 changed files with 5 additions and 7 deletions
|
@ -38,7 +38,7 @@ export default function MemberSidebar() {
|
||||||
|
|
||||||
function useEntries(
|
function useEntries(
|
||||||
channel: Channel,
|
channel: Channel,
|
||||||
renderListener: (effect: (keys: string[]) => void) => () => void,
|
generateKeys: () => string[],
|
||||||
isServer?: boolean,
|
isServer?: boolean,
|
||||||
) {
|
) {
|
||||||
const client = channel.client;
|
const client = channel.client;
|
||||||
|
@ -160,18 +160,16 @@ function useEntries(
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
return renderListener(sort);
|
return autorun(() => sort(generateKeys()));
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
}, [renderListener]);
|
}, [generateKeys]);
|
||||||
|
|
||||||
return entries;
|
return entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const GroupMemberSidebar = observer(
|
export const GroupMemberSidebar = observer(
|
||||||
({ channel }: { channel: Channel }) => {
|
({ channel }: { channel: Channel }) => {
|
||||||
const entries = useEntries(channel, (effect) =>
|
const entries = useEntries(channel, () => channel.recipient_ids!);
|
||||||
autorun(() => effect(channel.recipient_ids!)),
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<GenericSidebarBase data-scroll-offset="with-padding">
|
<GenericSidebarBase data-scroll-offset="with-padding">
|
||||||
|
@ -209,7 +207,7 @@ export const ServerMemberSidebar = observer(
|
||||||
|
|
||||||
const entries = useEntries(
|
const entries = useEntries(
|
||||||
channel,
|
channel,
|
||||||
(effect) => autorun(() => effect([...client.members.keys()])),
|
() => [...client.members.keys()],
|
||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue