Skip to content

Commit ff14d01

Browse files
nbbeekenCopilot
andauthored
Apply suggestions from code review
Co-authored-by: Copilot <[email protected]>
1 parent 07cfa90 commit ff14d01

File tree

3 files changed

+17
-22
lines changed

3 files changed

+17
-22
lines changed

packages/compass-aggregations/src/components/pipeline-toolbar/pipeline-options/pipeline-collation.tsx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,13 @@ const PipelineCollation: React.FunctionComponent<PipelineCollationProps> = ({
9494
}, [showMaxTimeMSWarning, maxTimeMSLimit]);
9595

9696
// Check if value exceeds the limit when warning is enabled
97-
const exceedsLimit = Boolean(
98-
useMemo(() => {
99-
return (
100-
showMaxTimeMSWarning &&
101-
maxTimeMSValue &&
102-
maxTimeMSValue >= WEB_MAX_TIME_MS_LIMIT
103-
);
104-
}, [showMaxTimeMSWarning, maxTimeMSValue])
105-
);
97+
const exceedsLimit = useMemo(() => {
98+
return (
99+
showMaxTimeMSWarning &&
100+
maxTimeMSValue &&
101+
maxTimeMSValue >= WEB_MAX_TIME_MS_LIMIT
102+
);
103+
}, [showMaxTimeMSWarning, maxTimeMSValue]);
106104

107105
return (
108106
<div

packages/compass-query-bar/src/components/query-option.tsx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -166,15 +166,13 @@ const QueryOption: React.FunctionComponent<QueryOptionProps> = ({
166166
return Number.isNaN(parsed) ? 0 : parsed;
167167
}, [value]);
168168

169-
const exceedsMaxTimeMSLimit = Boolean(
170-
useMemo(() => {
171-
return (
172-
name === 'maxTimeMS' &&
173-
showMaxTimeMSWarning &&
174-
numericValue >= WEB_MAX_TIME_MS_LIMIT
175-
);
176-
}, [name, showMaxTimeMSWarning, numericValue])
177-
);
169+
const exceedsMaxTimeMSLimit = useMemo(() => {
170+
return (
171+
name === 'maxTimeMS' &&
172+
showMaxTimeMSWarning &&
173+
numericValue >= WEB_MAX_TIME_MS_LIMIT
174+
);
175+
}, [name, showMaxTimeMSWarning, numericValue]);
178176

179177
return (
180178
<div

packages/compass-query-bar/src/stores/query-bar-reducer.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export const changeField = (
104104
const parsedValue = validateField(name, stringValue, {
105105
maxTimeMS: preferences.getPreferences().maxTimeMS ?? undefined,
106106
showMaxTimeMSWarning:
107-
Boolean(preferences.getPreferences().showMaxTimeMSWarning) ?? false,
107+
Boolean(preferences.getPreferences().showMaxTimeMSWarning),
108108
});
109109
const isValid = parsedValue !== false;
110110
dispatch({
@@ -166,9 +166,8 @@ export const resetQuery = (
166166
const fields = mapQueryToFormFields(
167167
{
168168
maxTimeMS: preferences.getPreferences().maxTimeMS,
169-
showMaxTimeMSWarning: Boolean(
170-
preferences.getPreferences().showMaxTimeMSWarning
171-
),
169+
showMaxTimeMSWarning:
170+
preferences.getPreferences().showMaxTimeMSWarning ?? false,
172171
},
173172
DEFAULT_FIELD_VALUES
174173
);

0 commit comments

Comments
 (0)