Page to page
A list and a detail screen as two separate documents. Press a row to go to the detail page, press 一覧へ戻る to come back.
Within one page there is nothing to solve
If the screen only swaps what it shows, the actor holds the order number. The order screen does exactly that.
Moving to another document is different. By the time the detail actor runs, the list actor is gone. What crosses has to live outside both of them.
A key, and where to come back to
When a row is pressed, the list writes two things: the order number the detail page needs, and what coming back will need.
Once at: 'detail' putJson: (Json object: {
#code -> (Json str: code).
#back -> (Json object: {
#filter -> (Json str: filter).
#top -> (Json int: top) }) }).
Loc assign: 'detail.html'.
Write first, then go. The other way round there is no actor left to write anything.
The detail page takes the order number and fetches the order again. Showing the copy the list was holding would put this morning's figure on the screen this afternoon.
Reading consumes it
Once take: reads and deletes in one operation. There is no "just look" from outside.
So reloading the detail page finds nothing. That is the same state as having opened the page directly, so it sends you to the list. The read-once store gives the screen its behaviour for free.
Going back, the detail page writes the return context out again. The list reads it once and restores the filter and the scroll position.
How it is checked
Neither the navigation nor the scroll restoration can be checked without a browser. So one is driven headless: press a row, read the order number on the detail page, reload and land on the list, come back and compare the filter and the scroll position.