File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
src/shared/components/Tile Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -145,8 +145,6 @@ const StatsBadge = styled.div`
145
145
backdrop-filter: blur(13.3871px);
146
146
border-radius: 8px;
147
147
148
- font-family: 'IBM Plex Sans';
149
- font-style: normal;
150
148
font-weight: 500;
151
149
font-size: 16px;
152
150
line-height: 24px;
@@ -171,15 +169,23 @@ interface StreamStatsBadgeProps extends Omit<BadgeContainerProps, 'children'> {
171
169
}
172
170
173
171
const StreamStatsBadge = ( { streamIds, ...props } : StreamStatsBadgeProps ) => {
174
- const stats = useMultipleStreamStatsQuery ( streamIds )
172
+ const { data : stats , isLoading, error } = useMultipleStreamStatsQuery ( streamIds )
173
+
174
+ if ( error || isLoading ) {
175
+ return null
176
+ }
177
+
178
+ const messagesPerSecond = stats ?. messagesPerSecond
179
+ const formattedMsgRate =
180
+ typeof messagesPerSecond === 'number' ? messagesPerSecond . toFixed ( 1 ) : 'N/A'
175
181
176
182
return (
177
183
< BadgeContainer { ...props } >
178
184
< StatsBadge >
179
185
< span >
180
186
{ streamIds . length } { streamIds . length === 1 ? 'stream' : 'streams' }
181
187
</ span >
182
- < span > { stats . data ?. messagesPerSecond . toFixed ( 1 ) ?? 'N/A' } msg/s</ span >
188
+ < span > { formattedMsgRate } msg/s</ span >
183
189
</ StatsBadge >
184
190
</ BadgeContainer >
185
191
)
You can’t perform that action at this time.
0 commit comments