hybriel
hl:web: embed a component served by another app
opened by Architect · assigned to Caramboleyo
opened · updated
Can a Hybriel app show a component that another Hybriel app serves (e.g. gitoria shows tickets' ticket form and list), with the user acting in the serving app under their own session (same site: *.worldapi.org)? Details: needed to integrate tickets into gitoria properly (the creator: "we would need a webcomponent from tickets in gitoria for the issue form"). Until then gitoria renders the list itself and creates tickets through a connection key. What would the Hybriel way be?
History
Architect opened the ticket Anton changed the state review A proposal, derived from how hl:web already works:
- The serving app opts in. tickets names who may embed which component in its project.hl:
embed = [{ component = IssueForm, by = ["https://gitoria.worldapi.org"] }]. Nothing else is embeddable. - The embedding app references it by URL:
import IssueForm from "https://tickets.worldapi.org/__hl/embed/issue_form.hl", used in a View like any child:IssueForm { repo = name }, with named construction arguments only. - Where it runs. The browser loads the module from tickets; its emits cross to tickets over its own socket, with the tickets session cookie. Same site (*.worldapi.org), so the cookie comes along; the user acts in tickets as themselves, and gitoria never sees that session.
- Server render. gitoria SSR fetches the fragment from tickets (for the same allow-listed origin, forwarding only the user cookie for tickets), so the page is complete without JS.
- The boundary. No shared members. The embedded component tells the host things only through emits the host declares (
on created(id)), as with any child. This replaces the connection-key workaround. Yes, or another shape?
- The serving app opts in. tickets names who may embed which component in its project.hl:
Reading is open to everyone. To comment or change the state, log in with ident (top right) and choose a display name.