feat: configurable backlinks sort order - #152
Merged
Merged
Conversation
Backlinks came out in raw DFS scan order, so after a couple weeks of use the latest references got buried at the bottom and you had to scroll to find them. Now they sort chronologically, most recently referenced page on top by default, with a visual toggle to flip the direction (Ctrl+O in the TUI, a header button on desktop and mobile) that persists to config.toml. The ordering lives in one place (outl_actions::sort_backlinks, group-stable by the block_id ULID), so the three clients can't drift. It's a pure display preference, stays out of the op log like theme.preset. Fixes #142 Signed-off-by: Avelino <31996+avelino@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Implements issue #142 by making backlinks (“Linked from”) order configurable across all clients, defaulting to newest-first and persisting the preference in config.toml. The actual ordering logic is centralized in outl_actions::sort_backlinks so TUI/desktop/mobile cannot drift.
Changes:
- Add
[display] backlinks_order = "newest" | "oldest"to the shared config schema and docs. - Centralize chronological, group-stable backlink ordering in
outl-actionsand call it from TUI + Tauri shared view builder. - Add per-client UI toggles (TUI
Ctrl+O, desktop/mobile header button) that persist via config save / Tauri command.
LGTM once the should-fix items are addressed.
No blockers.
Reviewed changes
Copilot reviewed 40 out of 40 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| docs/tui.md | Document Ctrl+O and inline backlinks ordering behavior in the TUI manual. |
| docs/shortcuts.md | Add the cross-client shortcut row for backlinks order toggle. |
| docs/shared-primitives.md | Catalog outl_actions::sort_backlinks as the single shared primitive. |
| docs/config.md | Document new [display] backlinks_order setting and its semantics. |
| docs/clients.md | Describe cross-client behavior + persistence for backlinks ordering. |
| crates/outl-tui/src/view/backlinks.rs | Render current order indicator in the inline backlinks header. |
| crates/outl-tui/src/state.rs | Add App::backlinks_newest_first state field with contract comments. |
| crates/outl-tui/src/runtime.rs | Load persisted backlinks order at boot and thread into the app. |
| crates/outl-tui/src/input/normal.rs | Bind Ctrl+O to toggle backlinks order in Normal mode. |
| crates/outl-tui/src/actions/nav.rs | Sort computed backlinks via outl_actions::sort_backlinks and persist toggle. |
| crates/outl-tui/src/actions/lifecycle/mod.rs | Initialize backlinks_newest_first default before runtime override. |
| crates/outl-tui/CLAUDE.md | Record the TUI-specific behavior contract for backlinks order toggle. |
| crates/outl-tauri-shared/src/state.rs | Add backlinks_order to PageView so GUIs can reflect current direction. |
| crates/outl-tauri-shared/src/helpers.rs | Read config order and apply sort_backlinks when building PageView. |
| crates/outl-tauri-shared/src/commands/page.rs | Add set_backlinks_order command body that persists + returns re-sorted view. |
| crates/outl-tauri-shared/CLAUDE.md | Document ownership of new set_backlinks_order and DTO field. |
| crates/outl-mobile/src/components/Journal.tsx | Wire backlinks_order and toggle handler through to BacklinksSection. |
| crates/outl-mobile/src/components/BacklinksSection.tsx | Add header button UI to flip order and show arrow/label. |
| crates/outl-mobile/src-tauri/src/lib.rs | Register set_backlinks_order command. |
| crates/outl-mobile/src-tauri/src/commands/page.rs | Add Tauri command shim for set_backlinks_order. |
| crates/outl-mobile/CLAUDE.md | Document mobile backlinks toggle wiring and command usage. |
| crates/outl-frontend-shared/src/api/types.ts | Add BacklinksOrder type and PageView.backlinks_order. |
| crates/outl-frontend-shared/src/api/commands.ts | Add setBacklinksOrder() invoke wrapper. |
| crates/outl-frontend-shared/CLAUDE.md | Document the new DTO/type and command wrapper in the shared frontend crate. |
| crates/outl-desktop/src/lib/store.ts | Add backlinksOrder to desktop app state. |
| crates/outl-desktop/src/lib/api.ts | Extend Settings interface with backlinks_order. |
| crates/outl-desktop/src/lib/action-handlers.test.ts | Update test fixtures for new PageView.backlinks_order field. |
| crates/outl-desktop/src/components/InlineBacklinks.tsx | Add header toggle button and persist via setBacklinksOrder. |
| crates/outl-desktop/src/App.tsx | Hydrate backlinksOrder from settings at boot. |
| crates/outl-desktop/src-tauri/src/settings.rs | Add wire mapping for backlinks order and preserve it on modal saves. |
| crates/outl-desktop/src-tauri/src/lib.rs | Register set_backlinks_order command. |
| crates/outl-desktop/src-tauri/src/commands/page.rs | Add Tauri command shim for set_backlinks_order. |
| crates/outl-desktop/CLAUDE.md | Document desktop backlinks toggle wiring and settings schema update. |
| crates/outl-config/src/schema.rs | Add BacklinksOrder, DisplayCfg, and Config.display with defaults + tests. |
| crates/outl-config/src/lib.rs | Re-export new config types and document [display] in crate docs. |
| crates/outl-config/CLAUDE.md | Update config contract and reader table to include display.backlinks_order. |
| crates/outl-actions/src/lib.rs | Export new backlinks_sort module and sort_backlinks. |
| crates/outl-actions/src/backlinks_sort.rs | New shared, tested sort implementation for backlinks ordering. |
| crates/outl-actions/CLAUDE.md | Document new backlinks_sort primitive and its invariants. |
| .github/copilot-instructions.md | Update shared-primitives checklist to include sort_backlinks. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backlinks came out in raw DFS scan order, so after a couple weeks of use the latest references got buried at the bottom and you had to scroll to find them.
Now they sort chronologically, most recently referenced page on top by default, with a visual toggle to flip the direction (Ctrl+O in the TUI, a header button on desktop and mobile) that persists to config.toml. The ordering lives in one place (outl_actions::sort_backlinks, group-stable by the block_id ULID), so the three clients can't drift. It's a pure display preference, stays out of the op log like theme.preset.
Fixes #142