Skip to content

Commit a325bd5

Browse files
committed
more coderabbit fixes
1 parent 9926521 commit a325bd5

2 files changed

Lines changed: 13 additions & 6 deletions

File tree

apps/webapp/app/components/admin/backOffice/RateLimitSection.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -283,20 +283,22 @@ function describeRateLimit(
283283
const perMin = (refillRate * 60_000) / intervalMs;
284284
let sustained: string;
285285
if (perMin >= 1) {
286-
sustained = `${Math.round(perMin).toLocaleString()} requests per minute`;
286+
sustained = `${formatRateValue(perMin)} requests per minute`;
287287
} else {
288288
const perHour = perMin * 60;
289289
if (perHour >= 1) {
290-
sustained = `${Math.round(perHour).toLocaleString()} requests per hour`;
290+
sustained = `${formatRateValue(perHour)} requests per hour`;
291291
} else {
292292
const perDay = perHour * 24;
293-
const formatted =
294-
perDay >= 10 ? Math.round(perDay).toLocaleString() : perDay.toFixed(1);
295-
sustained = `${formatted} requests per day`;
293+
sustained = `${formatRateValue(perDay)} requests per day`;
296294
}
297295
}
298296
return {
299297
sustained,
300298
burst: `${maxTokens.toLocaleString()} request burst allowance`,
301299
};
302300
}
301+
302+
function formatRateValue(value: number): string {
303+
return value >= 10 ? Math.round(value).toLocaleString() : value.toFixed(1);
304+
}

apps/webapp/app/routes/admin.back-office.orgs.$orgId.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,12 @@ export default function BackOfficeOrgPage() {
156156
: null;
157157

158158
const [searchParams, setSearchParams] = useSearchParams();
159-
const savedSection = searchParams.get(SAVED_QUERY_KEY);
159+
const savedSectionRaw = searchParams.get(SAVED_QUERY_KEY);
160+
// If the action just returned errors for the same section, hide the
161+
// "Saved." banner so it doesn't render alongside field errors. Suppressing
162+
// here propagates to every read site (auto-dismiss + JSX comparisons).
163+
const savedSection =
164+
errors && errorSection === savedSectionRaw ? null : savedSectionRaw;
160165

161166
// Auto-dismiss the "saved" banner after a few seconds.
162167
useEffect(() => {

0 commit comments

Comments
 (0)