Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions apps/app/src/components/LogsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ export function LogsView() {
className="text-xs px-3 py-1.5 border border-border bg-card text-txt cursor-pointer"
value={logLevelFilter}
onChange={handleLevelChange}
aria-label="Filter by log level"
>
<option value="">All levels</option>
<option value="debug">Debug</option>
Expand All @@ -111,6 +112,7 @@ export function LogsView() {
className="text-xs px-3 py-1.5 border border-border bg-card text-txt cursor-pointer"
value={logSourceFilter}
onChange={handleSourceChange}
aria-label="Filter by log source"
>
<option value="">All sources</option>
{logSources.map((s) => (
Comment on lines 112 to 118

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Potential runtime error if logSources is undefined or not an array

The code assumes logSources is always an array. If it is undefined or not an array, .map() will throw a runtime error:

{logSources.map((s) => (
  <option key={s} value={s}>{s}</option>
))}

Recommendation:
Add a defensive check to ensure logSources is an array before mapping:

{Array.isArray(logSources) && logSources.map((s) => (
  <option key={s} value={s}>{s}</option>
))}

Expand All @@ -125,6 +127,7 @@ export function LogsView() {
className="text-xs px-3 py-1.5 border border-border bg-card text-txt cursor-pointer"
value={logTagFilter}
onChange={handleTagChange}
aria-label="Filter by log tag"
>
<option value="">All tags</option>
{logTags.map((tag) => (
Comment on lines 127 to 133

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Duplicate tag values may cause confusing dropdown options

If logTags contains duplicate values, the dropdown will render multiple identical options, which can confuse users and complicate filter logic:

{logTags.map((tag) => (
  <option key={tag} value={tag}>{tag}</option>
))}

Recommendation:
Deduplicate logTags before rendering:

{[...new Set(logTags)].map((tag) => (
  <option key={tag} value={tag}>{tag}</option>
))}

Expand Down
Loading