Skip to content

Commit e826aa4

Browse files
Apply suggestions from code review
Co-authored-by: David Brochart <[email protected]>
1 parent e59b4e6 commit e826aa4

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

jupyter_ydoc/ynotebook.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -354,22 +354,21 @@ def _update_cell(self, old_cell: dict, new_cell: dict, old_ycell: Map) -> bool:
354354
kind = _CELL_KEY_TYPE_MAP[key]
355355

356356
if not isinstance(old_ycell[key], kind):
357-
# if our assumptions about types do not, fall back to hard update
357+
# if our assumptions about types do not hold, fall back to hard update
358358
return False
359359

360360
if kind == Text:
361361
old: Text = old_ycell[key]
362362
old.clear()
363-
old.insert(0, value)
363+
old += value
364364
elif kind == Array:
365365
old: Array = old_ycell[key]
366366
old.clear()
367367
old.extend(value)
368368
elif kind == Map:
369369
old: Map = old_ycell[key]
370370
old.clear()
371-
for k, v in value.items():
372-
old[k] = v
371+
old.update(value)
373372
else:
374373
old_ycell[key] = new_cell[key]
375374

0 commit comments

Comments
 (0)