Repository navigation
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…mentation Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
…port Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add examples of using MSW data source in frontend components
Add MSW frontend integration example with React components and hooks
Jan 25, 2026
hotlong
approved these changes
Jan 25, 2026
Contributor
|
@copilot 确认msw api规范与spec中约定的api标准协议是否一致? |
Contributor
Author
是的,MSW API 规范与 spec 中的标准协议一致。 经过验证: API 端点完全一致 ✅
响应格式一致 ✅
参考对比:
注: |
Contributor
|
前端组件应使用 @objectstack/client调用 api |
Contributor
@copilot |
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Contributor
Author
已完成重构。所有自定义 Hooks 现在都使用 更新的 Hooks:
变更详情:
提交: 8f71609 |
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copilot
AI
changed the title
Add MSW frontend integration example with React components and hooks
Add MSW frontend integration example with React components using @objectstack/client
Jan 25, 2026
This was referenced Sep 18, 2026
This branch had an error being deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds complete example demonstrating MSW (Mock Service Worker) integration in frontend React components for API mocking and CRUD operations. Components use the official
@objectstack/clientpackage for all API calls, following ObjectStack best practices.Implementation
React Components
UserManagement.tsx- Full CRUD with form validation, error statesUserList.tsx- Simplified component using custom hooks patternData Hooks (
useObjectData.ts) - Using @objectstack/clientuseObjectData<T>- Data fetching with auto-load, error handling, refetch usingclient.data.find()andclient.data.get()useCreateData<T>- Mutation with success/error callbacks usingclient.data.create()useUpdateData<T>- Partial updates usingclient.data.update()useDeleteData- Delete operations usingclient.data.delete()useMetadata<T>- Metadata retrieval usingclient.meta.getObject()with fallback supportDemo App (
demo.tsx)Usage Patterns
Custom Hooks (Recommended) - Using ObjectStack Client
Documentation
GUIDE_CN.md- Complete Chinese guide with API referenceQUICKSTART.md- 5-minute integration guideARCHITECTURE.md- Data flow diagrams and extensibility patternsSUMMARY.md- File navigation and use casesConfiguration
@objectstack/clientdependency for API callssrc/index.tsKey Features
✅ Official Client Integration - All hooks use
@objectstack/clientfor API calls✅ Best Practices - Follows ObjectStack recommended patterns
✅ Multi-baseUrl Support - Client instances managed per baseUrl
✅ Backward Compatible - Maintains existing hook interfaces
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.