@@ -1460,8 +1460,8 @@ export class SyncDoc extends EventEmitter {
1460
1460
this . assert_not_closed ( "initAll -- before ensuring syncstring exists" ) ;
1461
1461
await this . ensure_syncstring_exists_in_db ( ) ;
1462
1462
1463
- await this . init_syncstring_table ( ) ,
1464
- this . assert_not_closed ( "initAll -- successful init_syncstring_table" ) ;
1463
+ await this . init_syncstring_table ( ) ;
1464
+ this . assert_not_closed ( "initAll -- successful init_syncstring_table" ) ;
1465
1465
1466
1466
log ( "patch_list, cursors, evaluator, ipywidgets" ) ;
1467
1467
this . assert_not_closed (
@@ -1504,7 +1504,7 @@ export class SyncDoc extends EventEmitter {
1504
1504
// this will finish.
1505
1505
// if (!this.client.is_browser() && !this.client.is_project()) {
1506
1506
// // FAKE DELAY!!! Just to simulate flakiness / slow network!!!!
1507
- // await delay(10000 );
1507
+ // await delay(3000 );
1508
1508
// }
1509
1509
await retry_until_success ( {
1510
1510
f : this . init_load_from_disk ,
@@ -1563,22 +1563,28 @@ export class SyncDoc extends EventEmitter {
1563
1563
}
1564
1564
}
1565
1565
1566
+ let init ;
1566
1567
const is_init = ( t : SyncTable ) => {
1567
1568
this . assert_not_closed ( "is_init" ) ;
1568
1569
const tbl = t . get_one ( ) ;
1569
1570
if ( tbl == null ) {
1570
1571
dbg ( "null" ) ;
1571
1572
return false ;
1572
1573
}
1573
- return tbl . get ( "init" ) != null ;
1574
+ init = tbl . get ( "init" ) ?. toJS ( ) ;
1575
+ return init != null ;
1574
1576
} ;
1575
1577
dbg ( "waiting for init..." ) ;
1576
- const init = await this . syncstring_table . wait ( is_init , 0 ) ;
1578
+ await this . syncstring_table . wait ( is_init , 0 ) ;
1577
1579
dbg ( "init done" ) ;
1578
1580
if ( init . error ) {
1579
1581
throw Error ( init . error ) ;
1580
1582
}
1581
1583
assertDefined ( this . patch_list ) ;
1584
+ if ( init . size == null ) {
1585
+ // don't crash but warn at least.
1586
+ console . warn ( "SYNC BUG -- init.size must be defined" , { init } ) ;
1587
+ }
1582
1588
if (
1583
1589
! this . client . is_project ( ) &&
1584
1590
this . patch_list . count ( ) === 0 &&
@@ -2937,8 +2943,8 @@ export class SyncDoc extends EventEmitter {
2937
2943
size = data . length ;
2938
2944
dbg ( `got it -- length=${ size } ` ) ;
2939
2945
this . from_str ( data ) ;
2940
- // we also know that this is the version on disk, so we update the hash
2941
2946
this . commit ( ) ;
2947
+ // we also know that this is the version on disk, so we update the hash
2942
2948
await this . set_save ( {
2943
2949
state : "done" ,
2944
2950
error : "" ,
0 commit comments