-
Notifications
You must be signed in to change notification settings - Fork 27
History entries as a list or a tree #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I think there's some overlap between this and #9 - would you agree? |
There is some, but I think treating application history as a list or a tree is mostly orthogonal to the API for navigating that list/tree. The only difference I could see is that if it were treated as a tree if would be useful to have a way to get a list of the "children" of an entry. Every other action would work fine either way as long as you keep track of a main branch for the tree. |
I don't think this issue should impact our API design. Fundamentally, all browsers present history as a list to the user, and need to maintain an internal data structure which corresponds to that. The throwaway note in the HTML spec about presenting as a tree is mainly to emphasize that the HTML spec doesn't constrain browser UI; it only constrains the underlying data model. That said, the fact that the app history API preserves and exposes information about all the entries does mean that applications could present a tree view of the history to their users, in the same way the HTML spec talks about browsers hypothetically being able to do. I'd be curious to see some example code in that regard, if you have ideas. Regarding retrieving data from replaced entries, let me open a new issue about that. But I think the solution there isn't related to trees so much. |
One example I can think of would be having a page like |
Sure. But that's not compatible with browser's existing history models of a single linear joint session history (which we're not proposing to change), so it'd be something for the application to track by storing the appropriate data from |
It could be compatible if you keep track of which child entry is the most recent and ignore the other entries when using the existing interfaces. |
I'm talking about compatibility with the model, not the API. |
Currently history entries act as a list. As you push more entries the list gets longer, and if you go back to a previous entry and make another push it overwrites all of the previous future entries. I think this makes sense, and it's how a lot of other things work on computers as well (ex. undo/redo when typing a document). However with this new API each entry has a unique key, and as @domenic mentions in #7, this could lead to problems if you try to navigate to an entry that has been overwritten:
However, if history entries were treated as a tree rather than a list, the above code would not cause issues. There is even some allowance for this in the existing History API: https://html.spec.whatwg.org/multipage/history.html#history-notes
With the existing History API there is no way to actually navigate a tree, but with this new API there is.
The text was updated successfully, but these errors were encountered: