reset list of conversation switch

This commit is contained in:
Roland Osborne 2022-04-27 00:12:25 -07:00
parent 764c777c0c
commit 8cf1d2f24b
2 changed files with 6 additions and 5 deletions

View File

@ -25,7 +25,8 @@ export function Conversation() {
onClick={() => actions.close()} icon={<CloseOutlined />} /> onClick={() => actions.close()} icon={<CloseOutlined />} />
</div> </div>
<div class="thread"> <div class="thread">
<VirtualList items={state.topics} itemRenderer={topicRenderer} /> <VirtualList id={state.channelId + state.cardId}
items={state.topics} itemRenderer={topicRenderer} />
<BusySpin size="large" delay="1000" spinning={!state.init} /> <BusySpin size="large" delay="1000" spinning={!state.init} />
</div> </div>
<AddTopic /> <AddTopic />

View File

@ -21,7 +21,7 @@ export function VirtualList({ id, items, itemRenderer }) {
let containers = useRef([]); let containers = useRef([]);
let anchorBottom = useRef(true); let anchorBottom = useRef(true);
let listRef = useRef(); let listRef = useRef();
let view = useRef(null); let key = useRef(null);
const addSlot = (id, slot) => { const addSlot = (id, slot) => {
setSlots((m) => { m.set(id, slot); return new Map(m); }) setSlots((m) => { m.set(id, slot); return new Map(m); })
@ -36,7 +36,7 @@ export function VirtualList({ id, items, itemRenderer }) {
} }
const clearSlots = () => { const clearSlots = () => {
setSlots((m) => { new Map() }) setSlots((m) => { return new Map() })
} }
const growCanvasHeight = (val) => { const growCanvasHeight = (val) => {
@ -56,8 +56,8 @@ export function VirtualList({ id, items, itemRenderer }) {
}, [viewHeight]); }, [viewHeight]);
useEffect(() => { useEffect(() => {
if (view.current != id) { if (key.current != id) {
view.current = id; key.current = id;
latch.current = true; latch.current = true;
containers.current = []; containers.current = [];
anchorBottom.current = true; anchorBottom.current = true;