Fix type changes, tag navigation, and routing cleanup
- set_entry removes entry from old bucket when type changes (fixes duplicates) - PUT /api/entries/:id now accepts type field - Tag clicks navigate via URL (#type/x/tag/y or #tag/y) instead of mutating state - Replace magic 'all' hash with empty hash as the all-entries route - Clickable tags in entry detail view - Tag filter dropdown updates URL Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -127,6 +127,15 @@ export function get_entry(id) {
|
||||
}
|
||||
|
||||
export function set_entry(entry) {
|
||||
// Remove from any other bucket in case type changed
|
||||
for (const t of Object.keys(store.get('entry_types') ?? {})) {
|
||||
if (t === entry.type) { continue; }
|
||||
const bucket = store.get(t);
|
||||
if (bucket?.[entry.id]) {
|
||||
delete bucket[entry.id];
|
||||
store.set(t, bucket);
|
||||
}
|
||||
}
|
||||
const bucket = store.get(entry.type) ?? {};
|
||||
bucket[entry.id] = entry;
|
||||
store.set(entry.type, bucket);
|
||||
|
||||
Reference in New Issue
Block a user