Skip to content

Refactor: clean data/UI boundary — actions as data, app-level hook (#99) - #104

Open
mitschabaude wants to merge 3 commits into
mainfrom
data-layer-v2
Open

mitschabaude wants to merge 3 commits into
mainfrom
data-layer-v2

Conversation

@mitschabaude

Copy link
Copy Markdown
Member

What

Refactors the data ↔ UI boundary as prep for the data layer V2 rebuild.

Changes

  • Actions as data: UI dispatches { type, ...payload } objects via dispatch() instead of calling actions.createNote() etc.
  • App-level hook: useRepoData (per-repo) → useAppData (instantiated once in App.tsx). Session, auth, recents are properly global now.
  • Bidirectional routing: Route flows in via dispatch({ type: 'route-changed', route }). Active path flows out as state.activePath. The data layer never knows about URLs.
  • Removed leaky inputs: setActivePath and recordRecent callbacks no longer passed into the data hook.
  • Tests rewritten to use the new API directly.

Validation

  • npm run check clean
  • npm test — 172/172 pass
  • No UI file calls action functions directly (all go through dispatch)

Closes #99

- Replace useRepoData with app-level useAppData hook (instantiated once in App.tsx)
- Actions are now data: UI dispatches { type, ...payload } instead of calling functions
- Routing is bidirectional: route flows in via dispatch, activePath flows out as state
- Remove setActivePath and recordRecent as hook inputs
- Rewrite tests to use new useAppData + dispatch API
- All 172 tests pass, type check clean
@vercel

vercel Bot commented Mar 5, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
vibenote Ready Ready Preview, Comment Mar 5, 2026 11:24pm

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.

Cleanly separate data layer (global app state + git + storage) from UI

1 participant