Skip to content

Conversation

@tianzhou
Copy link
Member

No description provided.

Copilot AI review requested due to automatic review settings December 26, 2025 10:59
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances the request table by adding visual database type indicators and improving client information display. The changes focus on better UX through database logos in filter buttons and human-readable client names.

Key changes:

  • Added parseUserAgent utility to display readable browser/client names instead of raw user agent strings
  • Integrated database type logos into source filter buttons for better visual identification
  • Reordered table columns to move Client information to the end for better information hierarchy

</div>
</td>
<td className="px-4 py-2 text-sm text-muted-foreground whitespace-nowrap">
{parseUserAgent(request.client)}
Copy link

Copilot AI Dec 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parseUserAgent function is called for every row during each render. With up to 100 requests per source and potential re-renders when filtering or other state changes occur, this could result in unnecessary repeated parsing. Consider using useMemo to cache the parsed user agent values based on the requests array to avoid redundant regex operations.

Copilot uses AI. Check for mistakes.
Comment on lines +137 to 152
Promise.all([fetchRequests(), fetchSources()])
.then(([requestsData, sourcesData]) => {
setRequests(requestsData.requests);
const typeMap: Record<string, DatabaseType> = {};
for (const source of sourcesData) {
typeMap[source.id] = source.type;
}
setSourceTypes(typeMap);
setIsLoading(false);
})
.catch((err) => {
console.error('Failed to fetch requests:', err);
const message = err instanceof ApiError ? err.message : 'Failed to load requests';
console.error('Failed to fetch data:', err);
const message = err instanceof ApiError ? err.message : 'Failed to load data';
setError(message);
setIsLoading(false);
});
Copy link

Copilot AI Dec 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using Promise.all means that if either fetchRequests or fetchSources fails, the entire data load fails and the user sees an error screen even if requests data could have been loaded successfully. Consider handling these API calls separately or implementing partial failure handling so users can still view request data even if source type information fails to load.

Copilot uses AI. Check for mistakes.
@tianzhou tianzhou merged commit 4cd97ce into main Dec 26, 2025
8 checks passed
@tianzhou tianzhou deleted the new-request branch December 26, 2025 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants