dengliming opened a new issue, #630:
URL: https://github.com/apache/shenyu-dashboard/issues/630
## Description
Three effects run on mount. The `[apiMock.id]` effect populates
`initialValue` with the saved mock (id, host, port, header, query, body); the
`[apiDetail.apiPath]` effect then calls `setInitialValue({ url:
apiDetail.apiPath })`, replacing the whole object. Because React batches the
initial effects, the final state is `{ url }` only. When the same API is
re-opened, `apiMock.id` is unchanged so its effect does not run again and
nothing restores the lost fields.
## Location
(Lines refer to `master @ 83969a5`.)
- `src/routes/Document/components/ApiDebug.js:124-148`
## Impact
Open API A, click a tag, re-open API A: the debug form shows no saved
host/headers/query; "Reset" is a no-op because `initialValue.id` is undefined
and "Save" creates a new mock instead of updating the existing one.
## Suggested fix
Merge instead of replace: `setInitialValue(prev => ({ ...prev, url:
apiDetail.apiPath }))`.
## Related existing
None
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]