changeset 54:6933336a8fae

better init for VersionedGraph- start with empty graph, not undefined
author drewp@bigasterisk.com
date Mon, 13 Jan 2020 00:07:06 -0800
parents 601a604c097a
children 2936477ba3dd
files src/index.ts
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/index.ts	Mon Jan 13 00:06:36 2020 -0800
+++ b/src/index.ts	Mon Jan 13 00:07:06 2020 -0800
@@ -5,13 +5,14 @@
 
 import { GraphView } from "./graph_view";
 import { StreamedGraphClient } from "./streamed_graph_client";
+import { Store } from "n3";
 
 import style from "./style.styl";
 export * from "./graph_queries";
 
 export interface VersionedGraph {
   version: number;
-  store: N3Store | undefined;
+  store: N3Store;
 }
 
 function templateWithStyle(style: string, tmpl: HTMLTemplateElement) {
@@ -61,7 +62,8 @@
 
   ready() {
     super.ready();
-    this.graph = { version: -1, store: undefined };
+    const emptyStore = new Store();
+    this.graph = { version: -1, store: emptyStore };
     this.graphViewEl = (this.shadowRoot as ShadowRoot).getElementById(
       "graphView"
     ) as Element;