Hiccdown Development Notes

Showing only #5853 and its comments.

See full discussion
  Log in or sign up to participate in this discussion.
With an account, you can revise, criticize, and comment on ideas.

Discussions can branch out indefinitely. You may need to scroll sideways.
Dennis Hackethal’s avatar
Dennis HackethalOP​·​#5853​·​​·​AI-assisted
2nd of 3 versions​·​latest

Make Hiccdown reactive, like Reagent: a proc as the first element marks a component, as in [->(product) { [:li, product.name] }, @product].

The server keeps track of which components each page rendered, with which records, and gives each component's element the id dom_id(record), as turbo streams do. When a record changes (after_commit, checking that it actually changed), the server tells the pages showing it, over Action Cable. Each page then requests just that component, which renders in the viewer's own request, with their user, session, locale, time zone and CSRF token, and swaps it in with a turbo stream.

Rendering the component in the request that changed the record would save that round trip, but that request has none of the viewers' context: it would render for the wrong user, or have to rebuild each viewer's context and render once per viewer.

A first pass can skip checking whether a change affects what a component shows, as when a product's name changes on a page that only shows its price.

Criticized2
Dennis Hackethal’s avatar
Dennis HackethalOP​·​#5856​·​​·​AI-assisted

Procs can't be found again in a later request. The lambda a helper built while rendering the page is gone by the time the page asks for the component, so the server has no way to call it again.

Criticism of #5853
Dennis Hackethal’s avatar
Dennis HackethalOP​·​#5859​·​​·​System-generated

Superseded by #5858.

Criticism of #5853
Dennis Hackethal’s avatar
Dennis HackethalOP​·​#5855​·​​·​AI-assisted

Turbo 8 already does most of this. With broadcasts_refreshes and morphing, each viewer's page re-renders in their own request when a record changes, keeping scroll position and form state. Components would only save rendering and sending the rest of the page.

Criticism of #5853Criticized1
Dennis Hackethal’s avatar
Dennis HackethalOP​·​#5857​·​​·​AI-assisted

On large pages, like Veritula's discussions, that's too expensive: a refresh re-renders the whole page for every viewer, sends all of it, and morphs all of it, for a change to one idea. Components re-render, send and morph only what changed, so they'd give the same result as morphing on pages where morphing the whole page is too slow to use.

Criticism of #5855
  • Rationally adoptable.
  • Not rationally adoptable.
  • Older versions with pending criticisms.
  • Ideas are blue, criticisms red, comments small and gray.
  • Hover over ideas to expand them.
  • Click on ideas to jump to their place in the discussion.