fix: resolve library management issues
- Fix library edit form to use type_name instead of library_type_id for type dropdown - Clear library-id input after successful delete to prevent create-then-delete bug - This fixes the issue where creating a new library after deleting one would fail with 'Unknown error' due to stale library-id
This commit is contained in:
+6
-1
@@ -299,7 +299,7 @@ function editLibrary(libraryId: string): void {
|
||||
|
||||
if (nameInput) nameInput.value = library.name;
|
||||
if (descInput) descInput.value = library.description || '';
|
||||
if (typeInput) typeInput.value = library.library_type_id;
|
||||
if (typeInput) typeInput.value = library.type_name;
|
||||
}
|
||||
|
||||
const modalTitle = document.querySelector('#create-library-modal h2');
|
||||
@@ -384,6 +384,11 @@ async function confirmDeleteLibrary(): Promise<void> {
|
||||
}
|
||||
|
||||
await reloadLibraries();
|
||||
|
||||
const libraryIdInput = document.getElementById('library-id') as HTMLInputElement | null;
|
||||
if (libraryIdInput) {
|
||||
libraryIdInput.value = '';
|
||||
}
|
||||
} catch (error) {
|
||||
(window as any).api.handleError(error, 'Failed to delete library');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user