We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4c0f66e commit dc71f64Copy full SHA for dc71f64
jupyter_ydoc/ynotebook.py
@@ -225,7 +225,17 @@ def set(self, value: Dict) -> None:
225
nb_without_cells = {key: value[key] for key in value.keys() if key != "cells"}
226
nb = copy.deepcopy(nb_without_cells)
227
cast_all(nb, int, float) # Yjs expects numbers to be floating numbers
228
- cells = value["cells"]
+ 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
+ ]
239
240
with self._ydoc.transaction():
241
# clear document
0 commit comments