Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): render and filter usage as environments respond #9860

Mergedjuliusmarmingemerged 3 commits intomain fromrefs/pull/9860/headmerged by juliusmarminge View on GitHub

Showing 7 changed files with 35 additions and 6 deletions (loading 5).

x
0 of 7 viewed, 7 left
12 additions and 4 deletionsapps/web/src/components/usage/UsageLimits.tsxModified
View file
@@ -426,10 +426,18 @@
* Countdowns anchor to render time rather than ticking: a live clock would
* repaint the page every minute for no decision-changing gain.
-export function UsageLimitsSection() {
+export function UsageLimitsSection({
+ selectedEnvironmentIds,
+}: {
+ readonly selectedEnvironmentIds: ReadonlySet<EnvironmentId> | null;
+}) {
const presentations = useAtomValue(environmentPresentations.presentationsAtom);
- const groups = collectLimitsGroups(presentations);
- const sources = collectLimitSources(presentations);
+ const selected =
+ selectedEnvironmentIds === null
+ ? presentations
+ : new Map([...presentations].filter(([id]) => selectedEnvironmentIds.has(id)));
+ const groups = collectLimitsGroups(selected);
+ const sources = collectLimitSources(selected);
Resolvedby juliusmarminge
// Anchored once per mount on purpose: countdowns must not tick (see below).
const [now] = useState(() => Date.now());
​
@@ -437,7 +445,7 @@
<div className="flex flex-col gap-8">
{groups.length === 0 && sources.length === 0 ? (
<p className="text-sm text-muted-foreground">
- No provider on a connected environment reports subscription limits.
+ No provider on the selected environments reports subscription limits.