chore(store-reactjs-chat): bump js-waku to 0.28.0
This commit is contained in:
parent
439e6cb708
commit
a3fc334f97
|
@ -7,7 +7,7 @@
|
||||||
"@testing-library/jest-dom": "^5.16.4",
|
"@testing-library/jest-dom": "^5.16.4",
|
||||||
"@testing-library/react": "^13.2.0",
|
"@testing-library/react": "^13.2.0",
|
||||||
"@testing-library/user-event": "^14.1.1",
|
"@testing-library/user-event": "^14.1.1",
|
||||||
"js-waku": "0.27.0",
|
"js-waku": "0.28.0",
|
||||||
"protobufjs": "^7.1.0",
|
"protobufjs": "^7.1.0",
|
||||||
"react": "^18.1.0",
|
"react": "^18.1.0",
|
||||||
"react-dom": "^18.1.0",
|
"react-dom": "^18.1.0",
|
||||||
|
|
|
@ -5,7 +5,7 @@ specifiers:
|
||||||
'@testing-library/jest-dom': ^5.16.4
|
'@testing-library/jest-dom': ^5.16.4
|
||||||
'@testing-library/react': ^13.2.0
|
'@testing-library/react': ^13.2.0
|
||||||
'@testing-library/user-event': ^14.1.1
|
'@testing-library/user-event': ^14.1.1
|
||||||
js-waku: 0.27.0
|
js-waku: 0.28.0
|
||||||
protobufjs: ^7.1.0
|
protobufjs: ^7.1.0
|
||||||
react: ^18.1.0
|
react: ^18.1.0
|
||||||
react-dom: ^18.1.0
|
react-dom: ^18.1.0
|
||||||
|
@ -17,7 +17,7 @@ dependencies:
|
||||||
'@testing-library/jest-dom': 5.16.5
|
'@testing-library/jest-dom': 5.16.5
|
||||||
'@testing-library/react': 13.3.0_biqbaboplfbrettd7655fr4n2y
|
'@testing-library/react': 13.3.0_biqbaboplfbrettd7655fr4n2y
|
||||||
'@testing-library/user-event': 14.4.2_znfriv3ismgf3ybh2woqwlpfea
|
'@testing-library/user-event': 14.4.2_znfriv3ismgf3ybh2woqwlpfea
|
||||||
js-waku: 0.27.0
|
js-waku: 0.28.0
|
||||||
protobufjs: 7.1.0
|
protobufjs: 7.1.0
|
||||||
react: 18.2.0
|
react: 18.2.0
|
||||||
react-dom: 18.2.0_react@18.2.0
|
react-dom: 18.2.0_react@18.2.0
|
||||||
|
@ -7375,8 +7375,8 @@ packages:
|
||||||
/js-tokens/4.0.0:
|
/js-tokens/4.0.0:
|
||||||
resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==}
|
resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==}
|
||||||
|
|
||||||
/js-waku/0.27.0:
|
/js-waku/0.28.0:
|
||||||
resolution: {integrity: sha512-uIh1h2Gu+aEyrGb4qmyk2Sc91in3fMfOil0kdtrps9HnA7ESbC5c6d148LeJaxqH5rfOkrfXXIhw1zwA3hlauw==}
|
resolution: {integrity: sha512-MEIFugvio2IaQMQT+g+bn24BvlJ5S4PdSKD0AGVZlR7q1BhECwlpRoytyz0A/hC1+EJWhrZB8cpIAmxwtYWTBw==}
|
||||||
engines: {node: '>=16'}
|
engines: {node: '>=16'}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@chainsafe/libp2p-gossipsub': 4.1.1
|
'@chainsafe/libp2p-gossipsub': 4.1.1
|
||||||
|
|
|
@ -55,32 +55,40 @@ function App() {
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
if (wakuStatus !== "Connected") return;
|
if (wakuStatus !== "Connected") return;
|
||||||
|
|
||||||
const processMessages = (retrievedMessages) => {
|
(async () => {
|
||||||
const messages = retrievedMessages.map(decodeMessage).filter(Boolean);
|
|
||||||
|
|
||||||
setMessages((currentMessages) => {
|
|
||||||
return currentMessages.concat(messages.reverse());
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const startTime = new Date();
|
const startTime = new Date();
|
||||||
// 7 days/week, 24 hours/day, 60min/hour, 60secs/min, 100ms/sec
|
// 7 days/week, 24 hours/day, 60min/hour, 60secs/min, 100ms/sec
|
||||||
startTime.setTime(startTime.getTime() - 7 * 24 * 60 * 60 * 1000);
|
startTime.setTime(startTime.getTime() - 7 * 24 * 60 * 60 * 1000);
|
||||||
|
|
||||||
// TODO: Remove this timeout once https://github.com/status-im/js-waku/issues/913 is done
|
// TODO: Remove this timeout once https://github.com/status-im/js-waku/issues/913 is done
|
||||||
setTimeout(
|
await new Promise((resolve) => setTimeout(resolve, 200));
|
||||||
() =>
|
|
||||||
waku.store
|
try {
|
||||||
.queryHistory([ContentTopic], {
|
for await (const messagesPromises of waku.store.queryGenerator(
|
||||||
callback: processMessages,
|
[ContentTopic],
|
||||||
|
{
|
||||||
timeFilter: { startTime, endTime: new Date() },
|
timeFilter: { startTime, endTime: new Date() },
|
||||||
|
pageDirection: "forward",
|
||||||
|
}
|
||||||
|
)) {
|
||||||
|
const messages = await Promise.all(
|
||||||
|
messagesPromises
|
||||||
|
.map(async (p) => {
|
||||||
|
const msg = await p;
|
||||||
|
return decodeMessage(msg);
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.filter(Boolean)
|
||||||
|
);
|
||||||
|
|
||||||
|
setMessages((currentMessages) => {
|
||||||
|
return currentMessages.concat(messages.reverse());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
console.log("Failed to retrieve messages", e);
|
console.log("Failed to retrieve messages", e);
|
||||||
setWakuStatus("Error Encountered");
|
setWakuStatus("Error Encountered");
|
||||||
}),
|
}
|
||||||
200
|
})();
|
||||||
);
|
|
||||||
}, [waku, wakuStatus]);
|
}, [waku, wakuStatus]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
Loading…
Reference in New Issue