mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-29 16:24:58 +00:00
- Create asyncDataSlice.ts (426 lines)
* AsyncRequest interface for tracking request state
* AsyncDataState interface for global async state
* Four async thunks: fetchAsyncData, mutateAsyncData, refetchAsyncData, cleanupAsyncRequests
* Nine reducers for request state management
* Nine selectors for state access
* Automatic cleanup of old requests (>5min)
* Request deduplication via stable IDs
- Create redux/hooks-async workspace (1300+ lines)
* useReduxAsyncData hook: drop-in replacement for useQuery
- Automatic retries with configurable backoff
- Refetch on focus and refetch interval support
- Success/error callbacks
- Manual retry and refetch functions
* useReduxMutation hook: drop-in replacement for useMutation
- Execute mutations with loading/error tracking
- Status lifecycle tracking
- Multi-step mutation support for complex workflows
* useReduxPaginatedAsyncData: pagination helper
* useReduxMultiMutation: sequential mutation execution
- Create comprehensive unit tests (350+ lines)
* Test data fetching and state updates
* Test error handling and retries
* Test callbacks and status changes
* Test manual refetch/retry operations
* Test pagination functionality
* Full TypeScript type coverage
- Update root package.json to register redux/hooks-async workspace
- Create TANSTACK_TO_REDUX_MIGRATION_CHECKLIST.txt
* Tracks all 25 migration tasks across 5 phases
* Phase 1 now 100% complete
## Implementation Details
All async state stored in Redux, observable via DevTools:
- Requests tracked by ID for deduplication
- Automatic cleanup prevents memory leaks
- Status: idle → pending → succeeded/failed
- Refetching without clearing stale data
- Full TypeScript generic support
No breaking changes - API identical to previous hooks.
## Next Steps
Phase 2: Update api-clients to delegate to Redux hooks
Phase 3: Remove TanStack from providers and package.json
Phase 4: Validation & testing
Phase 5: Documentation updates
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
47 lines
1.1 KiB
JSON
47 lines
1.1 KiB
JSON
{
|
|
"name": "@metabuilder/hooks-async",
|
|
"version": "1.0.0",
|
|
"description": "Redux-backed async hooks (useReduxAsyncData, useReduxMutation) - drop-in replacement for TanStack React Query",
|
|
"type": "module",
|
|
"main": "dist/index.js",
|
|
"types": "dist/index.d.ts",
|
|
"scripts": {
|
|
"build": "tsc",
|
|
"test": "jest",
|
|
"typecheck": "tsc --noEmit"
|
|
},
|
|
"dependencies": {
|
|
"@metabuilder/redux-slices": "*",
|
|
"react": "^18.3.1",
|
|
"react-redux": "^8.1.3",
|
|
"@reduxjs/toolkit": "^1.9.7"
|
|
},
|
|
"devDependencies": {
|
|
"@testing-library/react": "^14.1.2",
|
|
"@testing-library/react-hooks": "^8.0.1",
|
|
"@types/jest": "^29.5.11",
|
|
"@types/react": "^18.2.45",
|
|
"jest": "^29.7.0",
|
|
"typescript": "^5.3.3"
|
|
},
|
|
"peerDependencies": {
|
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0"
|
|
},
|
|
"exports": {
|
|
".": {
|
|
"types": "./dist/index.d.ts",
|
|
"default": "./dist/index.js"
|
|
}
|
|
},
|
|
"keywords": [
|
|
"redux",
|
|
"hooks",
|
|
"async-data",
|
|
"mutations",
|
|
"react-query",
|
|
"tanstack"
|
|
],
|
|
"author": "MetaBuilder Team",
|
|
"license": "MIT"
|
|
}
|