Repository navigation
feat(base): open a saved view by default via settings.defaultViewSlug - #93
nicklaunches wants to merge 1 commit into
Conversation
A Base that is really a kanban board had to be reached through
/base/<slug>/<view> every time: the sidebar, breadcrumbs and search all
land on the bare route, which always opened the all-records grid.
Add `defaultViewSlug` to the closed node settings schema. The bare
/base/<slug> route now replaces itself with /base/<slug>/<defaultViewSlug>
when the Base node names an active view, so the URL stays canonical and
the pagination scope keeps keying off childId. An explicit childId still
wins. The view switcher's "All" tab links to /base/<slug>/all, a reserved
child id that is never redirected, so the grid stays reachable.
The Base settings dialog gets a "Default view" select (All records plus
the Base's active views). PATCH /nodes/{id}/settings validates the slug
against the Base's active views, and merging a view delete clears a
default that named it.
Closes busabase#92
Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
Hi @nicklaunches, thank you for this. The issue was clearly written and the PR is careful work: validation on write, cleanup when a view is deleted, tests, and labels for every locale. We ran it locally and it does what it says. Set Board as the default and the Base opens on the board, the All tab still gets you back to every record, and deep links to other views keep working. While reviewing it we talked through how we want views to work in general, and we'd like to go a slightly different way than a separate setting:
This also removes the need for a reserved The part we'd keep from your PR is the redirect from the bare Because the approach changes quite a bit, we won't merge this PR as it is. We'll build the new version on our side, reuse your redirect, and credit you as a co-author. We'll link it here when it lands. Thanks again for pushing on this. It's a real gap and your issue made it clear. |
|
Hi @mr-kelly, Thanks a lot for reply. Please let me know once its there. Really like your product so far and hope pushing more feedback |
What changed
Closes #92
A Base that is really a kanban board (a Tasks base with a
Boardview) had to be reached through/base/<slug>/boardevery time: the sidebar entry, breadcrumbs and search results all land on the bare route, and that route always opened the unsaved all-records grid.This adds a per-Base default view, stored as the node setting
defaultViewSlug, as proposed in the issue:nodeSettingsSchema(and theNodeSettings,NodeVO.settingsand DB column types) gaindefaultViewSlug: z.string().nullish(). The schema stays astrictObject.PATCH /nodes/{nodeId}/settings(and therefore thenodes_update_settingsMCP tool and the CLI command, both generated from the contract) accept the key. A non-null slug is validated on write: the node must be a Base and the slug must name one of its active views, otherwise the PATCH is a 400 / 404 instead of a silently ignored setting. The route's description now lists both keys./base/<slug>and the Base node's settings name an active view, the dashboard replaces the location with/base/<slug>/<defaultViewSlug>. The URL stays canonical and the pagination scope logic is untouched. An explicitchildIdalways wins, so deep links keep working./base/<slug>/all.allis a reserved child id that resolves to the grid and is never redirected, so the all-records grid stays reachable when a default view is set. It has its own route entry ahead of/base/:slug/:viewId.NodeSettingsDialog, General tab, same place as the AirApp engine picker): a "Default view" select with "All records" plus the Base's active views. Saved through the existingnodes.updateSettingsmutation;nullclears the key. Labels added to every locale.view_deleteclears the Base'sdefaultViewSlugwhen it named the archived view. Restoring the view does not bring the setting back.Validation
pnpm typecheck(busabase app) andpnpm --filter busabase-core typecheck: clean.pnpm lint(busabase app) pluspnpm exec biome check --writeover every changed file: clean.pnpm test(busabase app).pnpm --filter busabase-core exec vitest run tests/node-default-view-setting.test.ts src/domains/dashboard/helpers/default-view.test.ts: 10 new tests. The PGLite test covers the schema accepting the key and still rejecting unknown ones, storing a valid slug, clearing it when that view is deleted, leaving it alone when another view is deleted, rejecting a slug that names no active view, and rejecting the key on a non-Base node.pnpm --filter busabase-core exec vitest run src/domains/dashboard tests/base-lifecycle.test.ts tests/openapi-record-get-routes.test.ts tests/anonymous-allowlist.test.ts tests/node-metadata-update.test.ts: all passing.view-control-toolbar.spec.tsopens/base/blog, which has no default view, so its expectations are unchanged.Screenshots
Not captured: the only visual addition is a labelled select in the existing Base settings dialog, between the description field and the submit buttons.
Checklist
🤖 Generated with Claude Code