MCPcopy Create free account
hub / github.com/Linen-dev/linen.dev / loadMore

Function loadMore

apps/web/ui/ChannelView/TopicView/index.tsx:228–252  ·  view source on GitHub ↗
(next: boolean = false)

Source from the content-addressed store, hash-verified

226 }, []);
227
228 async function loadMore(next: boolean = false) {
229 if (isInfiniteScrollLoading || isScrolling) return;
230 try {
231 setInfiniteScrollLoading(true);
232 const data = await api.findTopics({
233 channelId: currentChannel.id,
234 sentAt: new Date(topics[0].sentAt),
235 accountId: currentCommunity.id,
236 });
237 if (data) {
238 if (next) {
239 setThreads((threads) => [...threads, ...data.threads]);
240 setTopics((topics) => [...topics, ...data.topics]);
241 } else {
242 setThreads((threads) => [...data.threads, ...threads]);
243 setTopics((topics) => [...data.topics, ...topics]);
244 }
245 }
246 setIsScrolling(true);
247 setInfiniteScrollLoading(false);
248 } catch (err) {
249 setError({ ...error });
250 setInfiniteScrollLoading(false);
251 }
252 }
253
254 const debouncedGetReadStatus = useCallback(debounce(api.getReadStatus), []);
255

Callers

nothing calls this directly

Calls 1

findTopicsMethod · 0.80

Tested by

no test coverage detected