aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant
diff options
context:
space:
mode:
authorSteve Klebanoff <steve.klebanoff@gmail.com>2018-11-29 02:38:24 +0800
committerSteve Klebanoff <steve.klebanoff@gmail.com>2018-11-29 02:38:24 +0800
commit06b2f12b10c6c2030b326b3e817d497415862299 (patch)
tree06144ff2e31aa4813e450bae6720054c1a6447a3 /packages/instant
parent53f8e1b3b426424bf4459605b48e706eb7fb6d90 (diff)
downloaddexon-sol-tools-06b2f12b10c6c2030b326b3e817d497415862299.tar
dexon-sol-tools-06b2f12b10c6c2030b326b3e817d497415862299.tar.gz
dexon-sol-tools-06b2f12b10c6c2030b326b3e817d497415862299.tar.bz2
dexon-sol-tools-06b2f12b10c6c2030b326b3e817d497415862299.tar.lz
dexon-sol-tools-06b2f12b10c6c2030b326b3e817d497415862299.tar.xz
dexon-sol-tools-06b2f12b10c6c2030b326b3e817d497415862299.tar.zst
dexon-sol-tools-06b2f12b10c6c2030b326b3e817d497415862299.zip
fix(instant): Fix uncontrolled input warning for token selector
Diffstat (limited to 'packages/instant')
-rw-r--r--packages/instant/src/components/erc20_token_selector.tsx8
1 files changed, 4 insertions, 4 deletions
diff --git a/packages/instant/src/components/erc20_token_selector.tsx b/packages/instant/src/components/erc20_token_selector.tsx
index 0a3d4427a..f7d5a4fe4 100644
--- a/packages/instant/src/components/erc20_token_selector.tsx
+++ b/packages/instant/src/components/erc20_token_selector.tsx
@@ -19,12 +19,12 @@ export interface ERC20TokenSelectorProps {
}
export interface ERC20TokenSelectorState {
- searchQuery?: string;
+ searchQuery: string;
}
export class ERC20TokenSelector extends React.Component<ERC20TokenSelectorProps> {
public state: ERC20TokenSelectorState = {
- searchQuery: undefined,
+ searchQuery: '',
};
public render(): React.ReactNode {
const { tokens, onTokenSelect } = this.props;
@@ -62,10 +62,10 @@ export class ERC20TokenSelector extends React.Component<ERC20TokenSelectorProps>
};
private readonly _isTokenQueryMatch = (token: ERC20Asset): boolean => {
const { searchQuery } = this.state;
- if (_.isUndefined(searchQuery)) {
+ const searchQueryLowerCase = searchQuery.toLowerCase().trim();
+ if (searchQueryLowerCase === '') {
return true;
}
- const searchQueryLowerCase = searchQuery.toLowerCase();
const tokenName = token.metaData.name.toLowerCase();
const tokenSymbol = token.metaData.symbol.toLowerCase();
return _.startsWith(tokenSymbol, searchQueryLowerCase) || _.startsWith(tokenName, searchQueryLowerCase);