Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove duplicated mock definitions causing warnings and operational failures #10927

Closed
wants to merge 1 commit into from

Conversation

zhangrenyang
Copy link
Contributor

The current code will give warnings after npm start is initiated:

warn

warn  - GET /api/rule is duplicated in C:\aprepare\myapp\mock\requestRecord.mock.js and C:\aprepare\myapp\mock\listTableList.ts
warn  - GET /api/currentUser is duplicated in C:\aprepare\myapp\mock\user.ts and C:\aprepare\myapp\mock\requestRecord.mock.js
warn  - POST /api/login/account is duplicated in C:\aprepare\myapp\mock\user.ts and C:\aprepare\myapp\mock\requestRecord.mock.js
warn  - POST /api/login/outLogin is duplicated in C:\aprepare\myapp\mock\user.ts and C:\aprepare\myapp\mock\requestRecord.mock.js

The reason is that listTableList.ts and requestRecord.mock.js have the same mock interface definitions.

Moreover, because requestRecord.mock.js will overwrite the mock definitions in listTableList.ts, the addition, modification, and deletion operations on the data in the query list page src\pages\TableList\index.tsx will have no effect, because it will always follow the hardcoded data in requestRecord.mock.js.

This requestRecord.mock.js seems to be a temporary file used for generating type definitions src/types/index.d.ts. Since the type definitions have already been generated, it seems that it is no longer needed. Can it be deleted? If so, the warning will disappear, and the operations on the query list page will also respond normally.

@github-actions
Copy link

⚡️ Deploying PR Preview...

@chenshuai2144
Copy link
Collaborator

这个是测试用的,无需关注

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.

2 participants