Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files Browse the repository at this point in the history
davidbrochart committed Oct 17, 2024

Verified

This commit was signed with the committer’s verified signature. The key has expired.
yihuang yihuang
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
@@ -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

0 comments on commit 3d8e568

Please sign in to comment.