# HG changeset patch # User drewp@bigasterisk.com # Date 1683579170 25200 # Node ID 9347277e831159f04c06bfeb09cd100c89d4e9f9 # Parent 3774ce9317a14ffabd76dd1a90c976ecfb6b4962 try a bit harder to notice children after startup diff -r 3774ce9317a1 -r 9347277e8311 src/ConfiguredSources.ts --- a/src/ConfiguredSources.ts Mon May 08 13:31:46 2023 -0700 +++ b/src/ConfiguredSources.ts Mon May 08 13:52:50 2023 -0700 @@ -46,7 +46,6 @@ newSourceGraph(s: SourceGraph) { this.graph.newStore(s); - this.viewConfigMaybeChanged(); } lostSourceGraph(s: SourceGraph) { diff -r 3774ce9317a1 -r 9347277e8311 src/MultiStore.ts --- a/src/MultiStore.ts Mon May 08 13:31:46 2023 -0700 +++ b/src/MultiStore.ts Mon May 08 13:52:50 2023 -0700 @@ -27,6 +27,11 @@ } newStore(s: SourceGraph) { + for (let ts of this.stores) { + if (ts==s.store) { + return; + } + } this.stores.push(s.store); const p = new Patch(PatchDirection.ADD); // todo s.sourceGraphChanged.subscribe((p) => { diff -r 3774ce9317a1 -r 9347277e8311 src/elements/streamed-graph/StreamedGraph.ts --- a/src/elements/streamed-graph/StreamedGraph.ts Mon May 08 13:31:46 2023 -0700 +++ b/src/elements/streamed-graph/StreamedGraph.ts Mon May 08 13:52:50 2023 -0700 @@ -23,6 +23,8 @@ @property() viewConfig: ViewConfig; // immutable, rebuilt when page or graph changes (in relevant ways) @state() statusSummary: TemplateResult[] = [html`...`]; + private observeChildren?: MutationObserver; + // @state() viewDirty: number = 0; static styles = [streamedGraphStyle]; constructor() { @@ -44,6 +46,10 @@ firstUpdated(ch: PropertyValueMap): void { super.firstUpdated(ch); this.scanChildNodesOnce(); + this.observeChildren = new MutationObserver(() => + this.scanChildNodesOnce() + ); + this.observeChildren.observe(this, { childList: true }); addFontToRootPage(); } @@ -77,6 +83,8 @@ const st = el.sourceGraph; if (st) { this.sources.newSourceGraph(st); + } else { + console.warn("el has no sourceGraph yet", el); } }