Skip to content

Commit

Permalink
Fix Message.data is undefined
Browse files Browse the repository at this point in the history
`Message.data` was made optional in ably-js v2 [1]

[1] ably/ably-js@4e3733f
  • Loading branch information
VeskeR committed Jul 17, 2024
1 parent 759603e commit 551f397
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/CursorHistory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default class CursorHistory {
const lastMessage = page.items.find((item) => item.connectionId === connectionId);
if (!lastMessage) return [connectionId, cursors];

const { data = [], clientId }: { data: OutgoingBuffer[] } & Pick<InboundMessage, 'clientId'> = lastMessage;
const { data = [], clientId }: { data?: OutgoingBuffer[] } & Pick<InboundMessage, 'clientId'> = lastMessage;

const lastPositionSet = data[data.length - 1]?.cursor;
const lastUpdate = lastPositionSet
Expand Down

0 comments on commit 551f397

Please sign in to comment.