Skip to content

Conversation

@emilkrebs
Copy link
Owner

  • improved database initialization to increase memory efficiency

@emilkrebs emilkrebs requested a review from Copilot January 10, 2026 00:39
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors database initialization to improve memory efficiency by moving from lazy initialization to eager initialization at application startup. The database instance is now created once in main.ts and exported for use across the application, eliminating the need for the getNoteDatabase() function and its associated service file.

Changes:

  • Replaced lazy database initialization with eager initialization in main.ts
  • Removed the database-service.ts file and replaced all getNoteDatabase() calls with direct access to the exported noteDatabase instance
  • Extracted copy button logic into a reusable CopyButton component to reduce code duplication
  • Updated dependencies to newer versions and reformatted configuration files

Reviewed changes

Copilot reviewed 12 out of 13 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
main.ts Added eager database initialization and export of noteDatabase instance
lib/services/database-service.ts Removed lazy initialization service entirely
routes/api/notes/[id].ts Replaced getNoteDatabase() calls with direct noteDatabase access
routes/api/notes.ts Replaced getNoteDatabase() calls with direct noteDatabase access
routes/[id].tsx Replaced getNoteDatabase() calls with direct noteDatabase access
components/CopyButton.tsx New reusable component extracted from CopyField.tsx
components/CopyField.tsx Refactored to use new CopyButton component
islands/ViewNote.tsx Replaced inline SVG with CopyButton component
lib/rate-limiting/src/hashing.ts Reformatted function signatures for consistency
tests/main_test.ts Added ARC_SECRET environment variable setup
tests/arc-rate-limiter_test.ts Added ARC_SECRET environment variable setup
deno.json Updated dependency versions and reformatted configuration

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

emilkrebs and others added 3 commits January 10, 2026 01:41
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@emilkrebs emilkrebs requested a review from Copilot January 10, 2026 00:58
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 14 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@emilkrebs emilkrebs merged commit 386be9d into main Jan 10, 2026
6 checks passed
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.

2 participants