Skip to content

Commit dc71f64

Browse files
Revert #266 (#280)
1 parent 4c0f66e commit dc71f64

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

Diff for: jupyter_ydoc/ynotebook.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,17 @@ def set(self, value: Dict) -> None:
225225
nb_without_cells = {key: value[key] for key in value.keys() if key != "cells"}
226226
nb = copy.deepcopy(nb_without_cells)
227227
cast_all(nb, int, float) # Yjs expects numbers to be floating numbers
228-
cells = value["cells"]
228+
cells = value["cells"] or [
229+
{
230+
"cell_type": "code",
231+
"execution_count": None,
232+
# auto-created empty code cell without outputs ought be trusted
233+
"metadata": {"trusted": True},
234+
"outputs": [],
235+
"source": "",
236+
"id": str(uuid4()),
237+
}
238+
]
229239

230240
with self._ydoc.transaction():
231241
# clear document

0 commit comments

Comments
 (0)