Skip to content

Commit

Permalink
Allow empty notebook (#266)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbrochart authored Aug 30, 2024
1 parent 925b257 commit 00ca649
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions jupyter_ydoc/ynotebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,17 +222,7 @@ 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"] 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()),
}
]
cells = value["cells"]

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

0 comments on commit 00ca649

Please sign in to comment.