Refactor: improve code quality, maintainability, and accessibility#54
Merged
mikenikles merged 1 commit intomainfrom Jan 9, 2026
Merged
Refactor: improve code quality, maintainability, and accessibility#54mikenikles merged 1 commit intomainfrom
mikenikles merged 1 commit intomainfrom
Conversation
## Phase 1: Error Handling Framework - Create centralized error handling in src/lib/errors/ - Add Result type, AppError interface, and ErrorCode enum - Add handleError function with severity-based routing ## Phase 2: Accessibility Improvements - Add aria-labels to pagination buttons in query-editor - Add aria-labels and keyboard handlers to query-history - Add aria-labels to sidebar-left star/delete buttons - Add translations for accessibility labels in all languages ## Phase 3: Type Organization - Reorganize types into src/lib/types/ directory - Split into database.ts, schema.ts, query.ts, explain.ts, erd.ts, persisted.ts - Add JSDoc documentation to exported interfaces - Create barrel export in index.ts ## Phase 4: State Management Migration (Map → Record) - Migrate all connection-keyed state from Map<string, T> to Record<string, T> - Update all 11 manager files to use spread syntax - Create record-utils.ts with helper functions - Delete map-utils.ts ## Phase 5-6: Component Extraction - Split query-editor.svelte (703 → 400 lines) into subcomponents: - query-toolbar.svelte - query-result-tabs.svelte - query-export-menu.svelte - query-pagination.svelte - query-error-display.svelte - Extract ssh-tunnel-config.svelte from connection-dialog.svelte Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements a comprehensive code quality improvement plan focusing on better maintainability, type safety, and accessibility.
Phase 1: Error Handling Framework
src/lib/errors/Resulttype for explicit error handlingAppErrorinterface with error codes and severity levelshandleErrorfunction with toast/console routing based on severityPhase 2: Accessibility Improvements
aria-labelsto pagination buttons in query-editoraria-labelsand keyboard handlers (onkeydownfor Enter key) to query-history itemsaria-labelsto sidebar-left star/delete buttonsPhase 3: Type Organization
types.tsintosrc/lib/types/directory:database.ts- DatabaseConnection, DatabaseType, SSHTunnelConfigschema.ts- SchemaTable, SchemaColumn, SchemaIndex, SchemaTabquery.ts- QueryTab, QueryResult, StatementResult, QueryHistoryItem, SavedQueryexplain.ts- ExplainTab, ExplainPlanNode, ExplainResulterd.ts- ErdTabpersisted.ts- All PersistedXxx typesPhase 4: State Management Migration (Map → Record)
Map<string, T>toRecord<string, T>record-utils.tswith helper functionsmap-utils.tsBenefits:
{...state, [key]: value}Phase 5-6: Component Extraction
query-editor.sveltefrom 703 → 400 lines into subcomponents:query-toolbar.svelte- Execute, format, save buttonsquery-result-tabs.svelte- Multi-statement result tabsquery-export-menu.svelte- Export/copy dropdownquery-pagination.svelte- Page navigation controlsquery-error-display.svelte- Error display for failed statementsssh-tunnel-config.sveltefromconnection-dialog.svelteTest plan
npm run check- TypeScript must pass ✅npm run tauri dev- App must start🤖 Generated with Claude Code