Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes the double input value when switching from between operator to … #35

Merged
merged 1 commit into from
Jan 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/components/attribute-filter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@
document.removeEventListener("mousedown", handleClickOutside);
window.removeEventListener("resize", handleResize);
};
// eslint-disable-next-line react-hooks/exhaustive-deps

Check warning on line 181 in src/components/attribute-filter.tsx

View workflow job for this annotation

GitHub Actions / Build & Run Tests

'react-hooks/exhaustive-deps' rule is disabled but never reported

Check warning on line 181 in src/components/attribute-filter.tsx

View workflow job for this annotation

GitHub Actions / S3 Deploy

'react-hooks/exhaustive-deps' rule is disabled but never reported
}, []);

// Move modal to bottom of window if window is too short
Expand Down Expand Up @@ -289,9 +289,13 @@
} else if (operator === "aboveMean" || operator === "belowMean") {
return null;
} else if (operator === "top" || operator === "bottom") {
return <input ref={filterValueTopBottomInputElRef} key={`${operator}-${units}`} className="filter-value" defaultValue={`${currentFilterValue || "100"}`}></input>;
return <input ref={filterValueTopBottomInputElRef} key={`${operator}-${units}`} className="filter-value"
defaultValue={`${Array.isArray(currentFilterValue) ? currentFilterValue[0] : "100"}`}>
</input>;
} else {
return <input ref={filterValueInputElRef} key={`${operator}-${units}`} className="filter-value" defaultValue={`${currentFilterValue} ${currentAttr?.unit[units]}`}></input>;
return <input ref={filterValueInputElRef} key={`${operator}-${units}`} className="filter-value"
defaultValue={`${Array.isArray(currentFilterValue) ? currentFilterValue[0] : "100"} ${currentAttr?.unit[units]}`}>
</input>;
}
};

Expand Down
Loading