akashchamp opened a new pull request, #712: URL: https://github.com/apache/shenyu-dashboard/pull/712
Fixes #638 The `initDic` callbacks in Selector and Rule wrote the dictionary lists straight into `this.state`, so options that arrived after mount only appeared if something else happened to re-render the modal. They now use `setState`. Rule used to start these requests from the constructor, where a cached dictionary comes back synchronously, so I moved its `initDics()` call into `componentDidMount` (same as Selector). That way both cached and fetched responses go through `setState`. For the discovery import, `configPropsJson` is now part of the same `setState` that shows the imported config. The imported property values are set with `setFieldsValue` once the fields have rendered. Before this, if you had edited a property field and then imported a config with the same key, the field kept your edited value and that value was submitted. The new `dictState.test.js` mounts the real Selector/Rule forms with a dispatch that holds dictionary callbacks and resolves them after mount. It also covers a synchronous (cached) response for Rule, plus an import over an edited field with a different key set. Without the fix, 3 of the 4 tests fail: the match-mode select still shows `0` and not `and`, and the import shows the stale edited value. With the fix, all 4 pass. Ran on Node 20: `npm test` (53 suites, 252 tests passing), `npm run lint` and `npm run build`. -- 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]
