Skip to content

Commit

Permalink
Fix metadata (#424)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbrochart committed Sep 16, 2024
1 parent 91940ba commit a92a341
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions python/jupytercad_lab/jupytercad_lab/notebook/cad_document.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,18 +141,13 @@ def add_annotation(
)
contents = [{"user": user, "value": message}]
if self._metadata is not None:
with self.ydoc.transaction() as t:
self._metadata.set(
t,
new_id,
json.dumps(
{
"position": position,
"contents": contents,
"parent": parent,
}
),
)
self._metadata[new_id] = json.dumps(
{
"position": position,
"contents": contents,
"parent": parent,
}
)
return new_id

def remove_annotation(self, annotation_id: str) -> None:
Expand All @@ -162,8 +157,7 @@ def remove_annotation(self, annotation_id: str) -> None:
:param annotation_id: The id of the annotation
"""
if self._metadata is not None:
with self.ydoc.transaction() as t:
self._metadata.pop(t, annotation_id, None)
del self._metadata[annotation_id]

def add_step_file(
self,
Expand Down

0 comments on commit a92a341

Please sign in to comment.