Prometheus Entity Management API
    Preparing search index...

    Class EntityDetailController<TRaw, TEntity>

    Lit 3 ReactiveController that subscribes to a single entity in the graph.

    Usage inside a Lit element:

    import { EntityDetailController } from "@prometheus-ags/entity-graph-web-components";

    class InvoiceDetail extends LitElement {
    readonly #detail = new EntityDetailController<RawInvoice, Invoice>(this, "Invoice", {
    id: "inv-1",
    fetch: (id) => api.getInvoice(id),
    normalize: (raw) => raw,
    });

    render() {
    if (this.#detail.isLoading) return html`<span>Loading…</span>`;
    if (!this.#detail.entity) return html`<span>Not found</span>`;
    return html`<p>${this.#detail.entity.title}</p>`;
    }
    }

    Type Parameters

    • TRaw
    • TEntity extends object

    Hierarchy (View Summary)

    Implements

    • ReactiveController
    Index
    entity: TEntity | null
    error: string | null
    isLoading: boolean
    • get isReady(): boolean

      Returns boolean

    • Called when the host is connected to the component tree. For custom element hosts, this corresponds to the connectedCallback() lifecycle, which is only called when the component is connected to the document.

      Returns void

    • Called when the host is disconnected from the component tree. For custom element hosts, this corresponds to the disconnectedCallback() lifecycle, which is called the host or an ancestor component is disconnected from the document.

      Returns void

    • Trigger a fresh fetch regardless of staleness (pull-to-refresh, post-save).

      Returns void

    • Update the entity id and re-subscribe. Call this when the element's attribute changes (e.g. from attributeChangedCallback).

      Parameters

      • id: string | null | undefined

      Returns void