Not decided yet
Components on the server — design
Status: implemented are markup as HTML, components of the server, their results,
Responsegoing up,Content<T>, component values with a result, decorators with guards, wrappers that take the body and the request context, routes, androoklang/server; the server of the site,site/server/main.rk, is written with them, and the guide has a section on them. The decisions are collected at the end of the document, together with what is not decided yet. Server markup, components androoklang/serverremain experimental in 1.x and may change between releases.
This document builds on components.md: components, decorators, context, components as values. It describes only what is different on the server.
- Streaming HTML. The head of a page could go out before the slow parts are ready, with a
ReadableStream; then aResponsefrom below would come too late for the status. Perhaps a decorator,@stream, that says a page may be sent in parts. - Islands. A component of the browser made with
@html-tagis a custom element, so the server can put<app-counter count={3}>into its HTML and a script of the browser bundle brings it to life. What is missing is how the server knows which scripts a page needs. - The CSS of
style. A component of the server withstylecould add its CSS once per response, into<head>; until thenstyleis an error on the server. - One component for both modes. A component without state, handlers and refs could be compiled both to DOM and to HTML, so that a page and its client share the markup.
- A decorator of a cache,
@cache("60s"), that answers from memory before the body runs (a guard) and keeps the result after it (a wrapper). - Whether a component of the server is marked
async. Now it is not: all of them are. The ordercomp X() Tis open as well. - A flag of the CLI for markup as HTML, as
--markupis for that of the browser; now the CLI takes it from the package.