kopia lustrzana https://github.com/bugout-dev/moonstream
Add correct load newer events.
rodzic
3424b9fbdf
commit
aa43f99273
|
@ -209,7 +209,8 @@ const useStream = (q, streamCache, setStreamCache, cursor, setCursor) => {
|
|||
let oldEventsList = streamCache;
|
||||
|
||||
setStreamCache([...newEvents.events, ...oldEventsList]);
|
||||
if (oldEventsList > 0) {
|
||||
|
||||
if (oldEventsList.length > 0) {
|
||||
setCursor(cursor + newEvents.events.length);
|
||||
}
|
||||
|
||||
|
@ -256,7 +257,11 @@ const useStream = (q, streamCache, setStreamCache, cursor, setCursor) => {
|
|||
q: streamQuery,
|
||||
...streamBoundary,
|
||||
});
|
||||
setNewerEvent({ ...response.data });
|
||||
if (response.data) {
|
||||
setNewerEvent({ ...response.data });
|
||||
} else {
|
||||
setNewerEvent(null);
|
||||
}
|
||||
return response.data;
|
||||
};
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue