Skip to content

Commit dd6e297

Browse files
authored
[Dataquery] return beneath regex (#9724)
Return statement entered under the CandID regex check if-block to prevent spamming the user with swals. * Resolves #9722
1 parent 7cf480c commit dd6e297

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

modules/dataquery/jsx/definefilters.importcsvmodal.tsx

+2-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {FileElement} from 'jsx/Form';
77

88
/**
99
* Render a modal window for adding a filter
10-
*
1110
* @param {object} props - React props
1211
* @param {function} props.setQuery - Function to set the current criteria
1312
* @param {function} props.closeModal - Callback to close the current modal
@@ -23,7 +22,6 @@ function ImportCSVModal(props: {
2322
const [idType, setIdType] = useState<string>('PSCID');
2423
/**
2524
* Promise for handling modal closing. Always accepts.
26-
*
2725
* @returns {Promise} - a stub promise
2826
*/
2927
const submitPromise = () =>
@@ -36,7 +34,6 @@ function ImportCSVModal(props: {
3634

3735
/**
3836
* Callback function for after papaparse has parsed the csv
39-
*
4037
* @param {any} value - the value from papaparse callback
4138
*/
4239
const csvParsed = (value: Papa.ParseResult<any>) => {
@@ -53,6 +50,7 @@ function ImportCSVModal(props: {
5350
// If sessions: validate 2 columns
5451
const expectedLength = (csvType === 'session' ? 2 : 1);
5552
const startLine = csvHeader ? 1 : 0;
53+
5654
for (let i = startLine; i < value.data.length; i++) {
5755
if (value.data[i].length != expectedLength) {
5856
swal.fire({
@@ -73,6 +71,7 @@ function ImportCSVModal(props: {
7371
+ ') on line '
7472
+ (i+1) + '.',
7573
});
74+
return;
7675
}
7776
}
7877
}

0 commit comments

Comments
 (0)