Skip to content

feat(data): add React data hooks and provider with swappable resolver#22

Merged
jheddings merged 1 commit intomainfrom
feat/data-hooks
Mar 30, 2026
Merged

feat(data): add React data hooks and provider with swappable resolver#22
jheddings merged 1 commit intomainfrom
feat/data-hooks

Conversation

@jheddings
Copy link
Copy Markdown
Collaborator

Summary

  • Adds DataResolver interface — the abstraction seam for swapping between local dev and production Workday APIs
  • Adds HttpResolver implementation that speaks the GraphQL-like protocol (find, findOne, create, update, delete) over fetch()
  • Adds DataProvider React context that supplies the resolver to child hooks
  • Adds useQuery<T>(model, options?) hook — returns { data, loading, error, refetch } (React Query-style)
  • Adds useMutation<T>(model) hook — returns { create, update, remove, loading, error } with auto-invalidation of active queries after mutations
  • All new types and functions exported from @workday/everywhere

This is Phase 2 of the data bindings feature, building on the schema types and code generation from #21. Phase 3 (local data service as Vite middleware) will make the hooks functional during everywhere view.

Test plan

  • 95 tests pass across 15 test files
  • just check passes (typecheck + lint)
  • HttpResolver tested with mocked fetch for all CRUD operations
  • useQuery/useMutation tested for correct shape and DataProvider requirement
  • Integration test with real data service (Phase 3)

🤖 Generated with Claude Code

Adds the runtime data layer for plugins:
- DataResolver interface as the abstraction for data access
- HttpResolver that speaks the GraphQL-like protocol over fetch
- DataProvider React context that supplies the resolver to hooks
- useQuery hook with loading/error/refetch (React Query-style)
- useMutation hook with create/update/remove + auto-invalidation

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jheddings jheddings merged commit df69afb into main Mar 30, 2026
2 checks passed
@jheddings jheddings deleted the feat/data-hooks branch March 30, 2026 22:41
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