@decentnetwork/beagle-ui 0.2.8 → 0.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/beagle-ui.js +7 -3
- package/package.json +1 -1
package/dist/beagle-ui.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const BEAGLE_UI_VERSION = "0.2.
|
|
1
|
+
export const BEAGLE_UI_VERSION = "0.2.9";
|
|
2
2
|
// src/icons.jsx
|
|
3
3
|
var ICON_PATHS = {
|
|
4
4
|
// ---- tab bar (the four must feel like one set) ----
|
|
@@ -384,11 +384,13 @@ function useDaemonData() {
|
|
|
384
384
|
const t = setInterval(refresh, 2500);
|
|
385
385
|
return () => clearInterval(t);
|
|
386
386
|
}, [refresh]);
|
|
387
|
+
const inFlight = React.useRef(/* @__PURE__ */ new Set());
|
|
387
388
|
const loadThread = React.useCallback(async (peerId) => {
|
|
388
|
-
if (!peerId)
|
|
389
|
+
if (!peerId || inFlight.current.has(peerId))
|
|
389
390
|
return;
|
|
391
|
+
inFlight.current.add(peerId);
|
|
390
392
|
try {
|
|
391
|
-
const d = await dkGet("/api/chat-history?peer=" + encodeURIComponent(peerId));
|
|
393
|
+
const d = await dkGet("/api/chat-history?peer=" + encodeURIComponent(peerId) + "&limit=200");
|
|
392
394
|
const arr = d.chats && d.chats[peerId] || [];
|
|
393
395
|
await prefetchThreadFiles(arr);
|
|
394
396
|
const msgs = arr.map((m) => ({
|
|
@@ -421,6 +423,8 @@ function useDaemonData() {
|
|
|
421
423
|
const withDay = msgs.length ? [{ day: dkDayLabel(arr[0].ts) }].concat(msgs) : [];
|
|
422
424
|
setThreads((t) => Object.assign({}, t, { [peerId]: withDay }));
|
|
423
425
|
} catch (e) {
|
|
426
|
+
} finally {
|
|
427
|
+
inFlight.current.delete(peerId);
|
|
424
428
|
}
|
|
425
429
|
}, []);
|
|
426
430
|
return Object.assign({}, snap, { threads, refresh, loadThread });
|
package/package.json
CHANGED