Skip to content

refactor: split preload, App.tsx, PluginsSection, and syncService monoliths - #215

Merged
github-actions[bot] merged 1 commit into
developfrom
refactor/split-remaining-monoliths
Apr 23, 2026
Merged

refactor: split preload, App.tsx, PluginsSection, and syncService monoliths#215
github-actions[bot] merged 1 commit into
developfrom
refactor/split-remaining-monoliths

Conversation

@tomymaritano

Copy link
Copy Markdown
Collaborator

Summary

Splits the 4 remaining monolithic files into focused modules.

File Before After Modules
preload/index.ts 1,227 161 14 API modules in preload/api/
App.tsx 1,010 643 4 hooks extracted
PluginsSection.tsx 1,043 11 (barrel) PluginCard, BrowseTab, PluginInspector
syncService.ts 1,065 18 (barrel) types, helpers, SyncService class

Combined with PR #214 (main/index.ts split), all 5 monoliths are resolved:

  • main/index.ts: 3,046 → 887
  • preload/index.ts: 1,227 → 161
  • App.tsx: 1,010 → 643
  • PluginsSection.tsx: 1,043 → 11
  • syncService.ts: 1,065 → 18

No behavior changes — purely structural.

Test plan

  • pnpm typecheck — 17/17 pass
  • pnpm test — 16/16 pass

🤖 Generated with Claude Code

preload/index.ts: 1227 → 161 lines
- Extract 14 API modules into preload/api/ (notes, notebooks, sync, etc.)
- Each module exports typed factory function + interface
- Barrel re-exports all types for renderer compatibility

App.tsx: 1010 → 643 lines
- Extract useDeepLinks, useAutoSave, useNoteActions, useAppCommands hooks
- App.tsx becomes a shell: providers + layout + hook composition

PluginsSection.tsx: 1043 → 11 lines (barrel)
- Extract PluginCard, BrowseTab, PluginInspector components
- New plugins/ directory with types.ts and composed index.tsx

syncService.ts: 1065 → 18 lines (barrel)
- Extract types, helpers to sync/ directory
- Core SyncService class in its own file
- Auto-sync timer and conflict resolver kept inline (too coupled)

No behavior changes — purely structural.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Apr 23, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
readide Error Error Apr 23, 2026 10:29pm

Request Review

@coderabbitai

coderabbitai Bot commented Apr 23, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@tomymaritano has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 41 minutes and 26 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 41 minutes and 26 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 1502fc64-66a0-4736-943c-ef660a843921

📥 Commits

Reviewing files that changed from the base of the PR and between a1a6679 and 045172a.

📒 Files selected for processing (32)
  • apps/desktop/src/main/services/sync/SyncService.ts
  • apps/desktop/src/main/services/sync/helpers.ts
  • apps/desktop/src/main/services/sync/index.ts
  • apps/desktop/src/main/services/sync/types.ts
  • apps/desktop/src/main/services/syncService.ts
  • apps/desktop/src/preload/api/ai.ts
  • apps/desktop/src/preload/api/app.ts
  • apps/desktop/src/preload/api/auth.ts
  • apps/desktop/src/preload/api/data.ts
  • apps/desktop/src/preload/api/devices.ts
  • apps/desktop/src/preload/api/git.ts
  • apps/desktop/src/preload/api/index.ts
  • apps/desktop/src/preload/api/notebooks.ts
  • apps/desktop/src/preload/api/notes.ts
  • apps/desktop/src/preload/api/plugins.ts
  • apps/desktop/src/preload/api/settings.ts
  • apps/desktop/src/preload/api/subscription.ts
  • apps/desktop/src/preload/api/sync.ts
  • apps/desktop/src/preload/api/types.ts
  • apps/desktop/src/preload/api/updates.ts
  • apps/desktop/src/preload/index.ts
  • apps/desktop/src/renderer/App.tsx
  • apps/desktop/src/renderer/hooks/useAppCommands.ts
  • apps/desktop/src/renderer/hooks/useAutoSave.ts
  • apps/desktop/src/renderer/hooks/useDeepLinks.ts
  • apps/desktop/src/renderer/hooks/useNoteActions.ts
  • apps/desktop/src/renderer/pages/settings/sections/PluginsSection.tsx
  • apps/desktop/src/renderer/pages/settings/sections/plugins/BrowseTab.tsx
  • apps/desktop/src/renderer/pages/settings/sections/plugins/PluginCard.tsx
  • apps/desktop/src/renderer/pages/settings/sections/plugins/PluginInspector.tsx
  • apps/desktop/src/renderer/pages/settings/sections/plugins/index.tsx
  • apps/desktop/src/renderer/pages/settings/sections/plugins/types.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/split-remaining-monoliths

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
github-actions Bot enabled auto-merge (squash) April 23, 2026 22:29
@github-actions
github-actions Bot merged commit 8deb73a into develop Apr 23, 2026
14 of 15 checks passed
tomymaritano added a commit that referenced this pull request Apr 23, 2026
#217)

## Patch v0.12.1

Critical fixes since v0.12.0:

### Bug Fixes
- **Fix "Object has been destroyed" crash on update** — safe broadcast
helper with double isDestroyed check + try/catch (#213)
- **Move single-instance lock before whenReady()** — prevents secondary
instances from initializing DB/IPC (#216)

### Architecture Refactor
- **main/index.ts**: 3,046 → 887 lines (10 IPC handler modules) (#214)
- **preload/index.ts**: 1,227 → 161 lines (14 API modules) (#215)
- **App.tsx**: 1,010 → 643 lines (4 hooks extracted) (#215)
- **PluginsSection.tsx**: 1,043 → 11 lines (3 sub-components) (#215)
- **syncService.ts**: 1,065 → 18 lines (types + helpers extracted)
(#215)

### CI Improvements
- Fix Linux build: expanded cache cleanup, removed corrupted fpm (#212)
- Remove broken dart-actions/tweet action (#210)
- Node.js 24 via FORCE_JAVASCRIPT_ACTIONS_TO_NODE24 (#212)
- Branch protection configured on develop + main (#216)

## Test plan
- [x] `pnpm typecheck` — 17/17 pass
- [x] `pnpm test` — 16/16 pass

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant