Skip to content

Commit

Permalink
Revert #266
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbrochart committed Oct 17, 2024
1 parent 4c0f66e commit 3d8e568
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion jupyter_ydoc/ynotebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,17 @@ def set(self, value: Dict) -> None:
nb_without_cells = {key: value[key] for key in value.keys() if key != "cells"}
nb = copy.deepcopy(nb_without_cells)
cast_all(nb, int, float) # Yjs expects numbers to be floating numbers
cells = value["cells"]
cells = value["cells"] or [
{
"cell_type": "code",
"execution_count": None,
# auto-created empty code cell without outputs ought be trusted
"metadata": {"trusted": True},
"outputs": [],
"source": "",
"id": str(uuid4()),
}
]

with self._ydoc.transaction():
# clear document
Expand Down

0 comments on commit 3d8e568

Please sign in to comment.