Add type-safe guard before LoggingLevel cast in LogControls
Validate the Select value against LOG_LEVELS before casting to LoggingLevel, ensuring the compiler isn't silently bypassed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
95e3a2dca7
commit
b068b564ab
1 changed files with 3 additions and 1 deletions
|
|
@ -73,7 +73,9 @@ export function LogControls({
|
|||
data={LOG_LEVELS.map((level) => ({ value: level, label: level }))}
|
||||
value={currentLevel}
|
||||
onChange={(value) => {
|
||||
if (value) onSetLevel(value as LoggingLevel);
|
||||
if (value && LOG_LEVELS.includes(value as LoggingLevel)) {
|
||||
onSetLevel(value as LoggingLevel);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<Button size="sm" onClick={() => onSetLevel(currentLevel)}>
|
||||
|
|
|
|||
Loading…
Reference in a new issue