# HG changeset patch # User drewp@bigasterisk.com # Date 1576310036 28800 # Node ID e0f5da648199bf02add78ae9024f135d319b9b9e # Parent 7fe46400f04b2f598822783c566e3261053a2ea6 fix getter, startup expanded state, better display before 1st data (but that one might not work) diff -r 7fe46400f04b -r e0f5da648199 src/streamed-graph.ts --- a/src/streamed-graph.ts Fri Dec 13 23:52:43 2019 -0800 +++ b/src/streamed-graph.ts Fri Dec 13 23:53:56 2019 -0800 @@ -10,7 +10,7 @@ import { GraphView } from './graph_view'; import { StreamedGraphClient } from './streamed_graph_client'; -interface VersionedGraph { version: number, store: N3Store|undefined }; +interface VersionedGraph { version: number, store: N3Store | undefined }; @customElement('streamed-graph') class StreamedGraph extends PolymerElement { @@ -23,8 +23,8 @@ @property({ type: Boolean }) expanded: boolean = false; - // @computed('expanded') - expandAction(): string { + @computed('expanded') + get expandAction() { return this.expanded ? '-' : '+'; } @@ -52,6 +52,9 @@ this.graphView = (this.shadowRoot as ShadowRoot).getElementById("graphView") as Element; this._onUrl(this.url); // todo: watch for changes and rebuild + if (this.expanded) { + this.redrawGraph(); + } } toggleExpand(ev: Event) { @@ -92,7 +95,12 @@ _redrawLater() { if (!this.graphViewDirty) return; - render(new GraphView(this.url, (this.graph as VersionedGraph).store as N3Store).makeTemplate(), this.graphView); - this.graphViewDirty = false; + + if ((this.graph as VersionedGraph).store && this.graph.store) { + render(new GraphView(this.url, this.graph.store).makeTemplate(), this.graphView); + this.graphViewDirty = false; + } else { + render(html`waiting for data...`, this.graphView); + } } } \ No newline at end of file