Skip to content

feat: run actions in order against the render they were made on - #55

Open
mk wants to merge 3 commits into
dynamic-alpha:mainfrom
nextjournal:render-versioned-actions
Open

mk wants to merge 3 commits into
dynamic-alpha:mainfrom
nextjournal:render-versioned-actions

Conversation

@mk

@mk mk commented Nov 5, 2026

Copy link
Copy Markdown

Actions now go through a custom Datastar action, @Hyperaction(id, params),
instead of one https://github.com/post per action. Each call numbers the action and queues it
with the page's signals and the render version of the HTML it was made on;
every request posts the tab's actions whose requests have not completed.
The server runs a tab's requests one at a time and skips sequence numbers it
has already run, so each action runs once and in the order it was made,
whichever request arrives first.

Each render that changes the HTML gets a version, sent as
data-hyper-render-version on #hyper-app (or on a reactive region's root for
a partial render), and its actions are kept under it. Positional action ids
are resolved against that render, so a click from an outdated page runs the
action it showed rather than whatever now sits at its position. A render of
the same HTML keeps its version; renders before the page version the client
shows are dropped.

mk added 3 commits November 4, 2026 12:07
Actions now go through a custom Datastar action, @Hyperaction(id, params),
instead of one @post per action. Each call numbers the action and queues it
with the page's signals and the render version of the HTML it was made on;
every request posts the tab's actions whose requests have not completed.
The server runs a tab's requests one at a time and skips sequence numbers it
has already run, so each action runs once and in the order it was made,
whichever request arrives first.

Each render that changes the HTML gets a version, sent as
data-hyper-render-version on #hyper-app (or on a reactive region's root for
a partial render), and its actions are kept under it. Positional action ids
are resolved against that render, so a click from an outdated page runs the
action it showed rather than whatever now sits at its position. A render of
the same HTML keeps its version; renders before the page version the client
shows are dropped.
An h/expr with a ; returns its value through __hyper_r, a statement that
only works as a whole handler. As a client param it sits in an action's
argument object or inside another expression, where it was a syntax
error, so such a param is now wrapped in a function.
An action brings the page's signals as they were when it was made. When
the server wrote a signal after that (an upload landing, say), the
action's copy overwrote it, and the client was never patched back.

Signal patches are now numbered and the client sends the number of the
last one it applied (hyperSignalSeq); a path the server wrote after that
keeps the server's value, which is then patched to the client.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant