changeset 2230:eeb2b3928715

fix 'unlink' button. (event was not well-typed)
author drewp@bigasterisk.com
date Wed, 24 May 2023 12:11:28 -0700
parents d193689223fb
children d9c14c716b36
files light9/web/SyncedGraph.ts
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/light9/web/SyncedGraph.ts	Wed May 24 11:27:54 2023 -0700
+++ b/light9/web/SyncedGraph.ts	Wed May 24 12:11:28 2023 -0700
@@ -197,17 +197,17 @@
     this._autoDeps.graphChanged(patch);
   }
 
-  getObjectPatch(s: N3.NamedNode, p: N3.NamedNode, newObject: N3.Quad_Object, g: N3.NamedNode): Patch {
+  getObjectPatch(s: N3.NamedNode, p: N3.NamedNode, newObject: N3.Quad_Object | null, g: N3.NamedNode): Patch {
     // make a patch which removes existing values for (s,p,*,c) and
     // adds (s,p,newObject,c). Values in other graphs are not affected.
     const existing = this.graph.getQuads(s, p, null, g);
     return {
       dels: existing,
-      adds: [this.Quad(s, p, newObject, g)],
+      adds: newObject !== null ? [this.Quad(s, p, newObject, g)] : [],
     };
   }
 
-  patchObject(s: N3.NamedNode, p: N3.NamedNode, newObject: N3.Quad_Object, g: N3.NamedNode) {
+  patchObject(s: N3.NamedNode, p: N3.NamedNode, newObject: N3.Quad_Object | null, g: N3.NamedNode) {
     this.applyAndSendPatch(this.getObjectPatch(s, p, newObject, g));
   }