fix(ext/vault): renderPane preserves in-memory newType when hash lacks /type
In the fullscreen UX, clicking '+ new item' set the hash to '#/add'
(no type) and called renderPane. The user then clicks a type button;
its handler calls setState({ newType: type }), which in vault.ts
triggers renderPane again. renderPane was unconditionally re-deriving
state.newType from the URL hash — clobbering the just-selected type
back to null. Result: the type-selection screen kept re-rendering and
no item could be created.
Fix: prefer route.type when present (deep-link case); otherwise keep
the in-memory state.newType. Same field order, same one-line touch.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -448,8 +448,10 @@ function renderPane(): void {
|
||||
}
|
||||
break;
|
||||
case 'add':
|
||||
// Sync newType from hash for the item-form component
|
||||
state.newType = (route.type as ItemType) ?? null;
|
||||
// Prefer hash type for deep-links; otherwise keep the in-memory value
|
||||
// set by the type-selection click handler (which calls setState →
|
||||
// renderPane before the URL hash has been updated to include the type).
|
||||
state.newType = (route.type as ItemType) ?? state.newType ?? null;
|
||||
renderItemForm(pane, 'add');
|
||||
break;
|
||||
case 'edit':
|
||||
|
||||
Reference in New Issue
Block a user