diff --git a/ts/adapter-element.ts b/ts/adapter-element.ts index 8a78900..522dbca 100644 --- a/ts/adapter-element.ts +++ b/ts/adapter-element.ts @@ -206,6 +206,17 @@ export class AdapterElement extends HTMLElement { return msg.id; } + // then, we should check if its parent is an orphan + const orphanedParent = this._orphans.find(o=>o.id == msg.replyTo); + if (orphanedParent) { + // then, try to place them both + + if (this.placeMsg(orphanedParent.id)) { + this._orphans.splice(this._orphans.indexOf(orphanedParent), 1); + return this.placeMsg(msg); + } + } + // otherwise we can orphan it and try to fill it in later if (this._orphans.filter(o=>o.id == msg.id).length == 0) { this._orphans.push(msg); diff --git a/ts/websocket.ts b/ts/websocket.ts index f4cb52e..1c0d180 100644 --- a/ts/websocket.ts +++ b/ts/websocket.ts @@ -37,17 +37,11 @@ function connect() { default: break; } - // if the adapter is active, inject the web components + // if the adapter is active signal it that there's new data let adapter = $(`adapter_${data.adapter}`); if (adapter) { adapter.setAttribute("data-latest", data.id); } - // FOR HOTFETCHED DATA: - // before fetching, we can set properties on the DOM, - // so when those data return to us we know where to inject components! - if (_("currentAdapter") == data.adapter) { - // dive in and insert that shit in the dom - } } }); _conn.addEventListener("error", (e: any) => {