feat(trails): default trail overview sort to newest first #52
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
public/wanderer!52
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/50-default-sort-created"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #50
What changed
The trail overview (
/trails, all display modes) now defaults to creation date, newest first. An explicit or saved choice still wins.routes/trails/+page.ts/routes/map/+page.ts: default filter uses the newDEFAULT_TRAIL_SORT(created,-). The list used to default tocreatedascending.lib/util/trail_filter_util.ts: new pure helpersresolveTrailSort,applyStoredTrailSort,readStoredTrailSort(throw-safe) anddefaultTrailSortOrder.sanitizeTrailFilternow falls back to the default direction instead of hard-coding ascending, and validatessortOrder.trail_list.svelte(cards/list/table): savedsort/sort_orderfrom localStorage are resolved through the helpers.map/+page.svelte: the map's side list already defaulted to newest first but ignored the saved choice on load. It now applies the saved choice too, and uses the same field-change rule.TrailFilter.sorttype widened to every option the UI offers. Before, values likedurationandlike_countwere only allowed through casts.Not changed / checked
createdis already in the trails indexSortableAttributes(db/main.gosearchIndexSettings, and migration1749831369). It is indexed as a unix timestamp (db/util/meilisearch.go), so no migration or hook change is needed.sort/sort_order, which is left as is./profile/[handle]) keep their own default. The issue scopes this to the trail overview.Tests
src/lib/util/trail_filter_sort.test.ts: covers the default, saved field/order precedence, a saved field without a direction, invalid saved values, storage that is missing or throws, and thesanitizeTrailFiltersort fallback.npm run check: 0 errors. The 2 warnings are already ondeploy, intrail/edit.vitest run: 846 passed, 13 skipped. There is 1 unhandled undiciReadableStream is already closedrejection attributed tosrc/lib/server/trail_analyze.test.ts, which this PR does not touch.https://claude.ai/code/session_01XMf4EGfBC9xbQ6rjD6HxgP
🤖 Generated with Claude Code
Shipped via batch PR #64 (
deploy0d0d85a4), which merged this branch head unchanged; live since 2026-11-05 ~19:30 CET inwanderer-web:deploy-676a7c62(homelab-flux #843). Forgejo does not mark stacked PRs as merged, so I am closing this by hand.🤖 Generated with Claude Code
Pull request closed