mirror of
https://github.com/urbit/shrub.git
synced 2024-11-28 13:54:20 +03:00
chat: lazier chat loading
Load smaller amounts of backlog when displaying a chat
This commit is contained in:
parent
8b83df00bd
commit
51a4816978
@ -38,8 +38,7 @@ export function ChatResource(props: ChatResourceProps) {
|
||||
const chatInput = useRef<ChatInput>();
|
||||
|
||||
useEffect(() => {
|
||||
const count = Math.min(150, unreadCount + 30);
|
||||
console.log(`fetching ${count}`);
|
||||
const count = Math.min(50, unreadCount + 15);
|
||||
props.api.graph.getNewest(owner, name, count);
|
||||
}, [station]);
|
||||
|
||||
|
@ -199,14 +199,14 @@ export default class ChatWindow extends Component<ChatWindowProps, ChatWindowSta
|
||||
const currSize = graph.size;
|
||||
if(newer && !this.loadedNewest) {
|
||||
const [index] = graph.peekLargest()!;
|
||||
await api.graph.getYoungerSiblings(ship,name, 100, `/${index.toString()}`)
|
||||
await api.graph.getYoungerSiblings(ship,name, 20, `/${index.toString()}`)
|
||||
if(currSize === graph.size) {
|
||||
console.log('loaded all newest');
|
||||
this.loadedNewest = true;
|
||||
}
|
||||
} else if(!newer && !this.loadedOldest) {
|
||||
const [index] = graph.peekSmallest()!;
|
||||
await api.graph.getOlderSiblings(ship,name, 100, `/${index.toString()}`)
|
||||
await api.graph.getOlderSiblings(ship,name, 20, `/${index.toString()}`)
|
||||
this.calculateUnreadIndex();
|
||||
if(currSize === graph.size) {
|
||||
console.log('loaded all oldest');
|
||||
|
Loading…
Reference in New Issue
Block a user