Skip to content
Snippets Groups Projects
Commit 114c509e authored by Dima Rifai's avatar Dima Rifai
Browse files

Remove comments

parent 29ee43af
No related branches found
No related tags found
No related merge requests found
Pipeline #112407 failed
...@@ -188,11 +188,11 @@ const SearchRanges: React.FC<SearchRangesProps> = ({ ...@@ -188,11 +188,11 @@ const SearchRanges: React.FC<SearchRangesProps> = ({
data-testid="headblock-number" data-testid="headblock-number"
type="text" type="text"
defaultValue={toBlock || ""} defaultValue={toBlock || ""}
onChange={(e) => handleNumericInput(e)} // Keep cleaning logic here on change onChange={(e) => handleNumericInput(e)}
placeholder={"To"} placeholder={"To"}
onBlur={(e: React.FocusEvent<HTMLInputElement>) => { onBlur={(e: React.FocusEvent<HTMLInputElement>) => {
const value = e.target.value; const value = e.target.value;
const numericValue = value ? Number(value) : undefined; // Default to NaN if empty string const numericValue = value ? Number(value) : undefined;
if ( if (
numericValue && numericValue &&
fromBlock && fromBlock &&
...@@ -201,13 +201,13 @@ const SearchRanges: React.FC<SearchRangesProps> = ({ ...@@ -201,13 +201,13 @@ const SearchRanges: React.FC<SearchRangesProps> = ({
numericValue < Number(fromBlock) numericValue < Number(fromBlock)
) { ) {
setBlockRangeError("To block must be greater than From block"); setBlockRangeError("To block must be greater than From block");
e.target.value = ""; // Clear the 'toBlock' field if validation fails e.target.value = "";
} else if (numericValue !=undefined && numericValue <= 0 && fromBlock) { } else if (numericValue !=undefined && numericValue <= 0 && fromBlock) {
setBlockRangeError("To block must be greater than From block"); setBlockRangeError("To block must be greater than From block");
e.target.value = ""; // Clear the 'toBlock' field if validation fails e.target.value = "";
} else { } else {
setToBlock(numericValue); // Set the state only when validation passes setToBlock(numericValue);
setBlockRangeError(null); // Clear error if valid setBlockRangeError(null);
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment