Skip to content

Commit c2df195

Browse files
committed
feat: add skipBatch context to TRPC queries in insights components
1 parent 8737a34 commit c2df195

File tree

4 files changed

+30
-11
lines changed

4 files changed

+30
-11
lines changed

src/client/components/insights/ChartRender.tsx

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,24 @@ export const ChartRender: React.FC<ChartRenderProps> = React.memo((props) => {
7575
[dateRange, dateUnit]
7676
);
7777

78-
const { data = [], isFetching } = trpc.insights.query.useQuery({
79-
workspaceId,
80-
insightId: props.insightId,
81-
insightType: props.insightType,
82-
metrics,
83-
filters,
84-
groups,
85-
time,
86-
});
78+
const { data = [], isFetching } = trpc.insights.query.useQuery(
79+
{
80+
workspaceId,
81+
insightId: props.insightId,
82+
insightType: props.insightType,
83+
metrics,
84+
filters,
85+
groups,
86+
time,
87+
},
88+
{
89+
trpc: {
90+
context: {
91+
skipBatch: true,
92+
},
93+
},
94+
}
95+
);
8796

8897
// Track query duration
8998
useEffect(() => {

src/client/components/insights/FilterSection.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ export const FilterSection: React.FC<FilterSectionProps> = React.memo(
3434
},
3535
{
3636
enabled: Boolean(insightId),
37+
trpc: {
38+
context: {
39+
skipBatch: true,
40+
},
41+
},
3742
}
3843
);
3944

src/client/components/insights/MetricsBlock.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ export const MetricsBlock: React.FC<MetricsBlockProps> = React.memo((props) => {
7878
}
7979
renderItem={(item) => (
8080
<>
81-
<LuMousePointerClick />
82-
<span>{item.name}</span>
81+
<LuMousePointerClick className="shrink-0" />
82+
<span className="overflow-hidden text-ellipsis">{item.name}</span>
8383
{typeof item.count === 'number' && item.count > 0 && (
8484
<span className="text-xs opacity-40">
8585
({formatNumber(item.count)})

src/client/components/insights/MetricsSection.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ export const MetricsSection: React.FC = React.memo(() => {
2828
select(data) {
2929
return [{ name: '$all_event', count: sumBy(data, 'count') }, ...data];
3030
},
31+
trpc: {
32+
context: {
33+
skipBatch: true,
34+
},
35+
},
3136
}
3237
);
3338

0 commit comments

Comments
 (0)