Skip to content

chore: improve code quality with proper error handling and types - #491

Merged
leoisadev1 merged 2 commits into
mainfrom
chore/code-quality-fixes
Jan 7, 2026
Merged

chore: improve code quality with proper error handling and types#491
leoisadev1 merged 2 commits into
mainfrom
chore/code-quality-fixes

Conversation

@leoisadev1

Copy link
Copy Markdown
Member

Summary

  • Add proper error logging to empty catch blocks
  • Replace any[] types with proper type definitions
  • Remove unsafe type casts

Changes

Error Handling

  • model.ts: Add console.warn to localStorage error catches (was silently swallowing errors)
  • app-sidebar.tsx: Add console.warn to localStorage error catches

Type Safety

  • pending-message.ts: Replace any[] with ChatFileAttachment interface
  • use-persistent-chat.ts: Replace any[] with ChatFileAttachment interface
  • model.ts: Add OpenRouterModel interface for API response typing, remove any from transformModel
  • app-sidebar.tsx: Use proper Convex Id<"chats"> type, remove unsafe as unknown as ChatItem[] casts

Testing

  • Build passes locally
  • LSP diagnostics clean on all modified files

- Add console.warn to empty catch blocks in model.ts and app-sidebar.tsx
- Replace any[] with ChatFileAttachment type in pending-message.ts
- Replace any[] with ChatFileAttachment type in use-persistent-chat.ts
- Add OpenRouterModel interface for API response typing in model.ts
- Use proper Convex Id<"chats"> type in app-sidebar.tsx
- Remove unsafe 'as unknown as' type casts
@github-actions

github-actions Bot commented Jan 7, 2026

Copy link
Copy Markdown
Contributor

🚀 Preview Deployment Ready

Environment URL
Frontend https://web-openchat-pr-491.up.railway.app
Convex Dashboard Dashboard

Convex Preview Backend

  • Cloud URL: https://impressive-armadillo-676.convex.cloud
  • Site URL: https://impressive-armadillo-676.convex.site

🤖 Deployed automatically by GitHub Actions

@leoisadev1

Copy link
Copy Markdown
Member Author

@greptileai review

The Railway build was failing because @server/convex/_generated/* imports
couldn't resolve - the Convex generated files don't exist during web-only builds.

Fix by running 'convex codegen' in the server directory first to generate
the required type files before building the web app.
@leoisadev1
leoisadev1 merged commit 9b80512 into main Jan 7, 2026
4 checks passed
@leoisadev1
leoisadev1 deleted the chore/code-quality-fixes branch January 7, 2026 23:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant