0025 The viewer tab keeps the view shown until another link opens¶
This record amends 0023 for what the tab keeps, and for one of its consequences. 0023 stays binding for everything else.
0001 asks a record and the one that amends it to link each other. It also says an accepted record is not edited. 0023 is accepted, so it is not edited here and does not link this record. The records so far do both: 0012 links the record that amends it, while 0003, 0010, 0015 and 0021 do not.
Context and Problem Statement¶
0023 keeps the view shown in the tab's sessionStorage, through the element's persist-view, until
the tab closes. It is one entry per tab, not one per link. The report reads it whenever the link
brings no view of its own in its fragment.
What a person saw (#1049): a later link opened in the same tab, without a view of its own, showed the view of the link before. The person expected the view of the link, or the source's default. How long should the tab keep the view shown?
The review of #1066 found two more points. A reload of a link with a view of its own opened with the link's view, since a link's view wins over the one kept. And the tab kept the address and view of every link it opened, until it closed.
Considered Options¶
- Keep the view shown until the tab closes: the page as 0023 built it.
- One entry per link: give the element a
storage-keyof its own for each link. - Drop the view shown when another link opens in the tab.
Decision Outcome¶
Chosen option: drop the view shown when another link opens. #1049 named this option and the key per link, and #1066 built this one. The reason: each link then opens with its own view or the source's default, and the links made before keep working.
- Until the tab closes: not kept, for the reason above.
- One entry per link: not chosen. A
storage-keyalso renames the link's fragment, from#pivot=to#pivot-<storageKey>=, so the links made before it would open without their view. It also keys the report's tips and saved views.
What the page does:
- Where the report shows rows, the tab keeps that address: the link's path, query and view (the fragment). In 0023 it kept the address only when the sign-in ended.
- When the page starts at that address again, by a reload or Sign in again, the view shown comes back, also for a link with a view of its own. The page drops the link's view, as 0023 does after a sign-in that ended. A sign-in of that start that is refused or fails keeps both, so the next reload still brings the view back.
- Any other address drops the view shown. That holds also for the same link with another view, or with none. Before any rows came, the person had only the link's view, so it stays, as in 0023.
- The tab keeps the link's address with its view only while the person signs in. The report's page deletes it when it opens, and uses its view only for that same link.
Consequences¶
- Good: a link opens with its own view or the source's default, whatever the tab showed before.
- Good: a reload keeps the view shown, also of a link with a view of its own.
- Good: the tab keeps less, and no entry for each link it opened.
- Good: a rename of the element's label keys fails a unit test (#1044), not only the browser test, which replaces 0023's consequence that only the browser test catches it.
- Bad: the page names the element's entry,
pivotkit:view:, a second time. A unit test ties it to the element's name. - Bad: a person who opens another link and then the first one again gets the first link's view, not the one they shaped there.
- Bad: the same address opened again in the tab, such as the same link clicked again in a mail, counts as a reload: the person gets the view they shaped, not the link's.