Skip to content

Commit

Permalink
Fix ledger fetching
Browse files Browse the repository at this point in the history
  • Loading branch information
quietbits committed May 31, 2024
1 parent 78d9eea commit 8044f7a
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions frontend/src/ducks/ledgers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,22 +184,19 @@ export const startLedgerStreamingAction = createAsyncThunk<
.ledgers()
.cursor("now")
.stream({
onmessage: (ledger) => {
onmessage: (ledger: any) => {
const { lastLedgerRecords } = ledgersSelector(getState());

if (!lastLedgerRecords[0]) {
return;
}

const ledgerRecord = ledger.records[0];
const timeDiff = getDateDiffSeconds(
ledgerRecord.closed_at,
ledger.closed_at,
lastLedgerRecords[0].closedAt,
);

dispatch(
updateLedgersAction(formatLedgerRecord(ledgerRecord, timeDiff)),
);
dispatch(updateLedgersAction(formatLedgerRecord(ledger, timeDiff)));
},
onerror: () => {
// do nothing
Expand Down

0 comments on commit 8044f7a

Please sign in to comment.