bito-code-review[bot] commented on code in PR #38490:
URL: https://github.com/apache/superset/pull/38490#discussion_r3531231379
##########
superset-frontend/src/features/databases/DatabaseModal/index.tsx:
##########
@@ -415,6 +416,15 @@ export function dbReducer(
[action.payload.name]: action.payload.checked,
};
}
+ if (action.payload.name === 'cache_timeout') {
+ const val = Number(action.payload.value);
+ return {
+ ...trimmedState,
+ cache_timeout: Number.isNaN(val)
+ ? undefined
+ : String(Math.max(-1, val)),
+ };
+ }
Review Comment:
<!-- Bito Reply -->
The implementation of the `cache_timeout` logic in the reducer, including
the handling of `NaN` values and the clamping of negative values, is correctly
addressed by the added tests. The changes effectively ensure that the cache
timeout behavior is now covered by the test suite.
**superset-frontend/src/features/databases/DatabaseModal/index.tsx**
```
if (action.payload.name === 'cache_timeout') {
const val = Number(action.payload.value);
return {
...trimmedState,
cache_timeout: Number.isNaN(val)
? undefined
: String(Math.max(-1, val)),
};
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]