Frontend UX: FieldsPage selection is not deep-linkable (state-only, inconsistent with vocab/objects routing) #72
Reference in New Issue
Block a user
Delete Branch "%!s()"
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?
web/src/fields/fields-page.tsx:15keeps the selected field definition in plain component state:Consequences:
recording_date"),/vocabularies/:id, objects use/objects/:id+ query params, search uses?q=.Suggested fix
Either a route param (
/fields/:key, matching vocabularies) or a search param (?key=…, matching the objects-table pattern of syncing viauseSearchParamswith{ replace: true }). Route param is the better fit since selection is the page's primary state.FieldList.onSelectnavigates; the page derivesselectedfrom the param + the already-cached field-defs query, and falls back to the create form when the key is absent/unknown.Note:
FieldFormis keyed byselected?.keyand the page is lazy-loaded — both keep working unchanged.Fixed in
ada5d06(merged as3ad0e56).Went with the route-param option: the route is now
/fields/:key?(optional segment, so/fieldsstill renders the create form).FieldList.onSelectnavigates to/fields/<key>, cancel/done navigates back to/fields, and the page derivesselectedfrom the already-cacheduseFieldDefinitions()query — no extra fetch, andFieldForm'skey={selected?.key ?? "create"}remount behavior is unchanged.Unknown/stale keys (including the key of a just-deleted field) fall back to the create form gracefully.
Tests: deep link opens the locked edit form, select→cancel round-trips through the URL, unknown key falls back to create. Reload/share/back-forward now all work, consistent with
/vocabularies/:id.