mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-14 23:21:35 +00:00
fix(review): address Greptile P2 findings
- test: add group_by_mock.assert_awaited_once() before await_args access so a non-call produces a clear AssertionError rather than AttributeError - ui: wrap tagListCall IIFE in try/catch; log error on failure instead of silently leaving the tag dropdown stale Co-Authored-By: Claude Sonnet 4 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
08b8ecab5c
commit
070158bac1
2 changed files with 15 additions and 8 deletions
|
|
@ -445,6 +445,7 @@ async def test_list_tags_without_date_range_omits_date_filter():
|
|||
response = client.get("/tag/list", headers=headers)
|
||||
|
||||
assert response.status_code == 200
|
||||
group_by_mock.assert_awaited_once()
|
||||
where = group_by_mock.await_args.kwargs["where"]
|
||||
assert "date" not in where
|
||||
|
||||
|
|
|
|||
|
|
@ -162,14 +162,20 @@ const UsagePage: React.FC<UsagePageProps> = ({ teams, organizations }) => {
|
|||
if (!accessToken) return;
|
||||
let cancelled = false;
|
||||
(async () => {
|
||||
const tags = await tagListCall(accessToken, startTime, endTime);
|
||||
if (cancelled) return;
|
||||
setAllTags(
|
||||
Object.values(tags).map((tag: Tag) => ({
|
||||
label: tag.name,
|
||||
value: tag.name,
|
||||
})),
|
||||
);
|
||||
try {
|
||||
const tags = await tagListCall(accessToken, startTime, endTime);
|
||||
if (cancelled) return;
|
||||
setAllTags(
|
||||
Object.values(tags).map((tag: Tag) => ({
|
||||
label: tag.name,
|
||||
value: tag.name,
|
||||
})),
|
||||
);
|
||||
} catch (e) {
|
||||
if (!cancelled) {
|
||||
console.error("Failed to fetch tag list", e);
|
||||
}
|
||||
}
|
||||
})();
|
||||
return () => {
|
||||
cancelled = true;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue