Repository source: docs/concepts/visit_tree.md
Visit tree
Purpose: Let a reader see which page led to which, and get back to any earlier branch of their reading, without the site learning anything about them.
Scenario: With FORUM_VISIT_HISTORY_ENABLED on (off by default), a reader opens the Board, a thread, goes back, then opens a second thread. Tools → History shows the Board with two branches under it, newest first, each visit with its title and time; a click opens that page. With Beside on, a thread opened in the pane sits under the page it was opened from, marked "beside", and links followed in the pane continue that branch. A second tab started from a link hangs under the page it came from; a tab typed into starts its own branch. Clear empties the tree and the next page starts a new one.
Sources: recorder (source unavailable), History page and its before-paint tree (source unavailable), styles (source unavailable) (.visit-tree), route (source unavailable) and controller (source unavailable) (history()), script wiring (source unavailable) (visitHistoryScriptPath, renderStandalonePage()), flag (source unavailable), page test (source unavailable), browser test (source unavailable), offline test (source unavailable), plans.
A visit is a page change: a page load, or a pushState to another address (path and query; a # spot is the same page, and the one-time hints __v and created_post_id are dropped). Back and forward, page-cache restores, reloads and loads at the current visit's address move the tab's cursor and add nothing; replaceState moves the current visit to the new address. The parent is the tab's current visit, kept in sessionStorage; a tab with none uses the latest visit at the referrer. The Beside pane keeps its own cursor in the same tab: open beside tells the recorder whether a pane load is a reader's click or the pane restored on the next main page, and Open alone moves the tab to the pane's visit. Frames other than the pane, such as the tour, record nothing. The History page records nothing about itself. Offline, the offline reader's pages are recorded like any other.
Storage is one local-storage key, forum_visit_history, holding up to 2,000 visits oldest first (internal browser state as JSON, like navigation slots). Visits are only added, each with an ID, so syncing a username's history across devices stays possible later. A visit whose parent was dropped heads its own branch. Full, missing or unreadable storage leaves pages working and History empty; a damaged key is replaced on the next visit. History never leaves the browser and is separate from the opt-in usage reports log, which strips IDs. Changing or signing out of a key keeps history.
Not covered yet: drawers and in-page tabs as visits, richer tree views and bookmarks (tree_history), the filmstrip (filmstrip) and syncing; see the browsing tree checklist.