File tree Expand file tree Collapse file tree 3 files changed +11
-3
lines changed
packages/cojson/src/storage Expand file tree Collapse file tree 3 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -298,6 +298,10 @@ export class StorageApiAsync implements StorageAPI {
298298
299299 const actuallyNewTransactions = newTransactions . slice ( actuallyNewOffset ) ;
300300
301+ if ( actuallyNewTransactions . length === 0 ) {
302+ return sessionRow ?. lastIdx || 0 ;
303+ }
304+
301305 let newBytesSinceLastSignature =
302306 ( sessionRow ?. bytesSinceLastSignature || 0 ) +
303307 actuallyNewTransactions . reduce (
Original file line number Diff line number Diff line change @@ -279,6 +279,10 @@ export class StorageApiSync implements StorageAPI {
279279
280280 const actuallyNewTransactions = newTransactions . slice ( actuallyNewOffset ) ;
281281
282+ if ( actuallyNewTransactions . length === 0 ) {
283+ return sessionRow ?. lastIdx || 0 ;
284+ }
285+
282286 let newBytesSinceLastSignature =
283287 ( sessionRow ?. bytesSinceLastSignature || 0 ) +
284288 actuallyNewTransactions . reduce (
Original file line number Diff line number Diff line change @@ -23,17 +23,17 @@ export function collectNewTxs({
2323 if ( ! sessionEntry ) {
2424 sessionEntry = {
2525 after : firstNewTxIdx ,
26- lastSignature : "WILL_BE_REPLACED" as Signature ,
26+ lastSignature : signature ,
2727 newTransactions : [ ] ,
2828 } ;
2929 contentMessage . new [ sessionRow . sessionID ] = sessionEntry ;
30+ } else {
31+ sessionEntry . lastSignature = signature ;
3032 }
3133
3234 for ( const tx of newTxsInSession ) {
3335 sessionEntry . newTransactions . push ( tx . tx ) ;
3436 }
35-
36- sessionEntry . lastSignature = signature ;
3737}
3838
3939export function getDependedOnCoValues (
You can’t perform that action at this time.
0 commit comments