best-unit 2.0.15 → 2.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "best-unit",
3
3
  "private": false,
4
- "version": "2.0.15",
4
+ "version": "2.0.16",
5
5
  "type": "module",
6
6
  "main": "dist/best-unit.cjs",
7
7
  "module": "dist/best-unit.js",
@@ -31,6 +31,7 @@ function StatisticalBalance(props: { popoverPosition?: PopoverPosition }) {
31
31
  currency: "USD",
32
32
  details: [],
33
33
  });
34
+ const [loading, setLoading] = useState(true);
34
35
 
35
36
  const fetchBalance = async () => {
36
37
  try {
@@ -81,9 +82,10 @@ function StatisticalBalance(props: { popoverPosition?: PopoverPosition }) {
81
82
  };
82
83
 
83
84
  setBalanceData(newBalanceData);
85
+ setLoading(false);
84
86
  } catch (err) {
85
87
  console.error("获取余额失败:", err);
86
- // 获取失败时保持默认的 $0 USD 显示
88
+ setLoading(false); // 即使失败也允许渲染(可按需做兜底)
87
89
  }
88
90
  };
89
91
 
@@ -152,6 +154,8 @@ function StatisticalBalance(props: { popoverPosition?: PopoverPosition }) {
152
154
  },
153
155
  ];
154
156
 
157
+ if (loading) return null;
158
+
155
159
  return (
156
160
  <HoverPopover
157
161
  popover={