dengliming commented on code in PR #663:
URL: https://github.com/apache/shenyu-dashboard/pull/663#discussion_r4101066667
##########
src/routes/Exception/triggerException.js:
##########
@@ -18,23 +18,14 @@
import React, { PureComponent } from "react";
import { Button, Spin, Card } from "antd";
import { connect } from "dva";
+import PropTypes from "prop-types";
import styles from "./style.less";
-@connect((state) => ({
- isloading: state.error.isloading,
+@connect(({ loading }) => ({
+ isloading: loading.effects["error/query"],
Review Comment:
[P2] Default the effect loading flag to false before the first dispatch
Initially, dva-loading has `effects: {}`, so this expression returns
`undefined`. Ant Design's `Spin` defaults `spinning` to `true` when it receives
`undefined`, which puts a loading overlay over the trigger buttons immediately
on entering the page. The `TriggerException.defaultProps` assignment below
applies to the decorated connect wrapper; the mapped `undefined` overrides that
value before reaching the inner component. I reproduced this by rendering the
connected component with `{ loading: { effects: {} } }`: `.ant-spin-spinning`
is present without a request. Using `!!loading.effects["error/query"]` makes
that test pass. Please normalize this value and add a regression test for the
initial render.
--
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]