@@ -239,6 +239,10 @@ export class WidgetManager {
239
239
A simple example that uses buffers is this image one:
240
240
https://ipywidgets.readthedocs.io/en/latest/examples/Widget%20List.html#image
241
241
*/
242
+
243
+ console . log ( "TEMPORARILY skipping buffers change!!" ) ;
244
+ return ;
245
+
242
246
const model = await this . manager . get_model ( model_id ) ;
243
247
const { buffer_paths, buffers } =
244
248
await this . ipywidgets_state . get_model_buffers ( model_id ) ;
@@ -249,13 +253,15 @@ export class WidgetManager {
249
253
for ( let i = 0 ; i < buffer_paths . length ; i ++ ) {
250
254
// TODO/concern: what if buffer_paths is deeper (length > 1)?
251
255
// Will that break something? We do set things properly later.
252
- const buffer = buffers [ i ] ;
253
256
const key = buffer_paths [ i ] [ 0 ] ;
254
- const value =
255
- serializers [ key ] ?. serialize ( { buffer, ...deserialized_state [ key ] } ) ??
256
- deserialized_state [ key ] ??
257
- null ; // must be null, not undefined, so can json.
258
- change [ key ] = value ;
257
+ if ( deserialized_state [ key ] == null ) {
258
+ change [ key ] = null ;
259
+ continue ;
260
+ }
261
+ const buffer = buffers [ i ] ;
262
+ const s = serializers [ key ] ?. serialize ( deserialized_state [ key ] ) ?? { } ;
263
+ s . value = { buffer } ;
264
+ change [ key ] = s ;
259
265
}
260
266
log ( "handleBuffersChange: " , model_id , change ) ;
261
267
model . set_state ( change ) ;
@@ -412,7 +418,7 @@ export class WidgetManager {
412
418
return await this . manager . get_model ( model_id ) ;
413
419
} ;
414
420
415
- private dereferenceModelLinks = async ( state ) : Promise < boolean > => {
421
+ dereferenceModelLinks = async ( state ) : Promise < boolean > => {
416
422
// log("dereferenceModelLinks", "BEFORE", state);
417
423
for ( const key in state ) {
418
424
const val = state [ key ] ;
@@ -568,6 +574,19 @@ class Environment implements WidgetEnvironment {
568
574
// upstream widget manager works). This works around that.
569
575
state [ "outputs" ] = [ ] ;
570
576
}
577
+ const { buffer_paths, buffers } =
578
+ await this . manager . ipywidgets_state . get_model_buffers ( model_id ) ;
579
+ for ( let i = 0 ; i < buffer_paths . length ; i ++ ) {
580
+ // TODO/concern: what if buffer_paths is deeper (length > 1)?
581
+ // Will that break something? We do set things properly later.
582
+ const buffer = buffers [ i ] ;
583
+ const key = buffer_paths [ i ] [ 0 ] ;
584
+ // TODO -- but what about deeply nested key!?
585
+ // I only figured out to use value:{buffer} from looking at
586
+ // the bqplot source code.
587
+ state [ key ] = { ...state [ key ] , value : { buffer } } ;
588
+ }
589
+
571
590
setTimeout ( ( ) => this . manager . watchModel ( model_id ) , 1 ) ;
572
591
return {
573
592
modelName : state . _model_name ,
0 commit comments