report null instead of 0 for a stream with no cached bandwidth sample

This commit is contained in:
Josh Hawkins
2026-08-17 09:06:54 -05:00
parent aaf96522f4
commit 5437192289
4 changed files with 55 additions and 7 deletions
@@ -204,9 +204,12 @@ export function CombinedStorageGraph({
const getStreamSplit = useCallback(
(row: StorageRow, field: keyof StreamStorage) => {
const sub = row.streams?.sub;
const mainValue = row.streams?.main?.[field];
const subValue = row.streams?.sub?.[field];
if (!sub) {
// omit the split entirely when either side is unknown, rather than
// showing a zero that would read as "this stream costs nothing"
if (mainValue == null || subValue == null) {
return null;
}
@@ -216,13 +219,13 @@ export function CombinedStorageGraph({
<span className="text-muted-foreground">
{t("quality.main", { ns: "components/player" })}
</span>{" "}
{getUnitSize(row.streams?.main?.[field] ?? 0)}
{getUnitSize(mainValue)}
</div>
<div>
<span className="text-muted-foreground">
{t("quality.sub", { ns: "components/player" })}
</span>{" "}
{getUnitSize(sub[field])}
{getUnitSize(subValue)}
</div>
</div>
);
+1 -1
View File
@@ -103,7 +103,7 @@ export type StorageStats = {
export type StreamStorage = {
usage: number;
bandwidth: number;
bandwidth: number | null;
};
export type CameraStorage = {