slightly tweak thread creation algo

This commit is contained in:
Iris Lightshard 2024-07-06 12:43:25 -06:00
parent 2f2b596270
commit 6fc115ff41
Signed by: Iris Lightshard
GPG key ID: 688407174966CAF3
2 changed files with 12 additions and 7 deletions

View file

@ -206,6 +206,17 @@ export class AdapterElement extends HTMLElement {
return msg.id; 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 // otherwise we can orphan it and try to fill it in later
if (this._orphans.filter(o=>o.id == msg.id).length == 0) { if (this._orphans.filter(o=>o.id == msg.id).length == 0) {
this._orphans.push(msg); this._orphans.push(msg);

View file

@ -37,17 +37,11 @@ function connect() {
default: default:
break; 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}`); let adapter = $(`adapter_${data.adapter}`);
if (adapter) { if (adapter) {
adapter.setAttribute("data-latest", data.id); 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) => { _conn.addEventListener("error", (e: any) => {