Skip to content

Commit fd55ded

Browse files
ymkiuxclaude
andcommitted
fix: resolve Recharts ResponsiveContainer width/height -1 error
- Use fixed pixel height instead of percentage for ResponsiveContainer - Add minHeight guard to ChartContainer's ResponsiveContainer - Upgrade bytedance/sonic v1.14.2 → v1.15.0 for Go 1.26.0 compat - Add keepPreviousData to usage stats query Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 070607f commit fd55ded

File tree

5 files changed

+13
-10
lines changed

5 files changed

+13
-10
lines changed

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.26.0
44

55
require (
66
github.com/andybalholm/brotli v1.2.0
7-
github.com/bytedance/sonic v1.14.2
7+
github.com/bytedance/sonic v1.15.0
88
github.com/getlantern/systray v1.2.2
99
github.com/glebarez/sqlite v1.11.0
1010
github.com/golang-jwt/jwt/v5 v5.3.0
@@ -26,7 +26,7 @@ require (
2626
filippo.io/edwards25519 v1.1.0 // indirect
2727
github.com/bep/debounce v1.2.1 // indirect
2828
github.com/bytedance/gopkg v0.1.3 // indirect
29-
github.com/bytedance/sonic/loader v0.4.0 // indirect
29+
github.com/bytedance/sonic/loader v0.5.0 // indirect
3030
github.com/cloudwego/base64x v0.1.6 // indirect
3131
github.com/dlclark/regexp2 v1.11.5 // indirect
3232
github.com/dustin/go-humanize v1.0.1 // indirect

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ github.com/bep/debounce v1.2.1 h1:v67fRdBA9UQu2NhLFXrSg0Brw7CexQekrBwDMM8bzeY=
1010
github.com/bep/debounce v1.2.1/go.mod h1:H8yggRPQKLUhUoqrJC1bO2xNya7vanpDl7xR3ISbCJ0=
1111
github.com/bytedance/gopkg v0.1.3 h1:TPBSwH8RsouGCBcMBktLt1AymVo2TVsBVCY4b6TnZ/M=
1212
github.com/bytedance/gopkg v0.1.3/go.mod h1:576VvJ+eJgyCzdjS+c4+77QF3p7ubbtiKARP3TxducM=
13-
github.com/bytedance/sonic v1.14.2 h1:k1twIoe97C1DtYUo+fZQy865IuHia4PR5RPiuGPPIIE=
14-
github.com/bytedance/sonic v1.14.2/go.mod h1:T80iDELeHiHKSc0C9tubFygiuXoGzrkjKzX2quAx980=
15-
github.com/bytedance/sonic/loader v0.4.0 h1:olZ7lEqcxtZygCK9EKYKADnpQoYkRQxaeY2NYzevs+o=
16-
github.com/bytedance/sonic/loader v0.4.0/go.mod h1:AR4NYCk5DdzZizZ5djGqQ92eEhCCcdf5x77udYiSJRo=
13+
github.com/bytedance/sonic v1.15.0 h1:/PXeWFaR5ElNcVE84U0dOHjiMHQOwNIx3K4ymzh/uSE=
14+
github.com/bytedance/sonic v1.15.0/go.mod h1:tFkWrPz0/CUCLEF4ri4UkHekCIcdnkqXw9VduqpJh0k=
15+
github.com/bytedance/sonic/loader v0.5.0 h1:gXH3KVnatgY7loH5/TkeVyXPfESoqSBSBEiDd5VjlgE=
16+
github.com/bytedance/sonic/loader v0.5.0/go.mod h1:AR4NYCk5DdzZizZ5djGqQ92eEhCCcdf5x77udYiSJRo=
1717
github.com/cloudwego/base64x v0.1.6 h1:t11wG9AECkCDk5fMSoxmufanudBtJ+/HemLstXDLI2M=
1818
github.com/cloudwego/base64x v0.1.6/go.mod h1:OFcloc187FXDaYHvrNIjxSe8ncn0OOM8gEHfghB2IPU=
1919
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=

web/src/components/ui/chart.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ function ChartContainer({
6363
{...props}
6464
>
6565
<ChartStyle id={chartId} config={config} />
66-
<RechartsPrimitive.ResponsiveContainer>{children}</RechartsPrimitive.ResponsiveContainer>
66+
<RechartsPrimitive.ResponsiveContainer width="100%" height="100%" minHeight={1}>
67+
{children}
68+
</RechartsPrimitive.ResponsiveContainer>
6769
</div>
6870
</ChartContext.Provider>
6971
);

web/src/hooks/queries/use-usage-stats.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* 支持多层级时间粒度聚合
44
*/
55

6-
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
6+
import { keepPreviousData, useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
77
import { getTransport, type UsageStatsFilter, type StatsGranularity } from '@/lib/transport';
88

99
// Query Keys
@@ -117,6 +117,7 @@ export function useUsageStats(filter?: UsageStatsFilter) {
117117
return useQuery({
118118
queryKey: usageStatsKeys.list(filter),
119119
queryFn: () => getTransport().getUsageStats(filter),
120+
placeholderData: keepPreviousData,
120121
});
121122
}
122123

web/src/pages/stats/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -898,8 +898,8 @@ export function StatsPage() {
898898
</Tabs>
899899
</CardHeader>
900900
<CardContent className="pt-2">
901-
<div className="w-full" style={{ height: '400px' }}>
902-
<ResponsiveContainer width="100%" height="100%">
901+
<div className="w-full h-[400px] min-h-[400px]">
902+
<ResponsiveContainer width="100%" height={400}>
903903
<ComposedChart data={chartData}>
904904
<CartesianGrid strokeDasharray="3 3" stroke="var(--border)" opacity={0.5} />
905905
<XAxis

0 commit comments

Comments
 (0)