Skip to content

Refactor/separate db logic from react components#12

Open
JuanTorres93 wants to merge 36 commits into
devftkrshna:mainfrom
JuanTorres93:refactor/separate-db-logic-from-react-components
Open

Refactor/separate db logic from react components#12
JuanTorres93 wants to merge 36 commits into
devftkrshna:mainfrom
JuanTorres93:refactor/separate-db-logic-from-react-components

Conversation

@JuanTorres93
Copy link
Copy Markdown

@JuanTorres93 JuanTorres93 commented May 7, 2026

Description

Fixes #10

Extracts all raw Dexie.js database queries out of React components and into dedicated service files under src/services/db/, following the separation of concerns described in the issue.

New service files

Each file groups database operations for a single domain:

  • dbContents.js
  • dbContests.js
  • dbFormulas.js
  • dbGate.js
  • dbHabits.js
  • dbJobs.js
  • dbPomodoros.js
  • dbProblems.js
  • dbQuickLinks.js
  • dbSettings.js
  • dbSnippets.js
  • dbTasks.js

Refactored components

All database logic removed from: Dashboard, ContentCurator, FormulaVault, JobTracker, HabitTracker, LeetCode, Pomodoro, Profile, SnippetBoard, TodoList, GatePrep, and popup.jsx.

Custom hook

Introduced useDBQuery — a reusable hook that handles calling DB service functions, reducing boilerplate across components and keeping the UI synchronized with database updates.

Type of change

  • Maintenance / Refactoring (non-functional changes)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce.

  • Verified locally via Extension loading in developer mode.
  • Checked for console errors or warnings.
  • Verified UI looks good and behaves correctly.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings

JuanTorres93 and others added 30 commits May 6, 2026 18:38
Co-authored-by: Copilot <copilot@github.com>
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.

[Refactor] Separate Database Logic from React Components

1 participant