From 90a1b3d678097fb436ef79f87f2cc7eb3db9f604 Mon Sep 17 00:00:00 2001 From: jessop Date: Fri, 19 Apr 2019 14:05:55 -0400 Subject: [PATCH] displays snackbar instead of greenscreen on bad url --- src/ui/component/wunderbar/index.js | 2 ++ src/ui/component/wunderbar/view.jsx | 6 ++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ui/component/wunderbar/index.js b/src/ui/component/wunderbar/index.js index 9945ff217..76c01ed3b 100644 --- a/src/ui/component/wunderbar/index.js +++ b/src/ui/component/wunderbar/index.js @@ -4,6 +4,7 @@ import { doBlurSearchInput, doUpdateSearchQuery, doSearch, + doToast, selectSearchValue, selectSearchSuggestions, selectSearchBarFocused, @@ -31,6 +32,7 @@ const perform = (dispatch, ownProps) => ({ dispatch(doUpdateSearchQuery('')); }, updateSearchQuery: query => dispatch(doUpdateSearchQuery(query)), + doShowSnackBar: message => dispatch(doToast({ isError: true, message })), doFocus: () => dispatch(doFocusSearchInput()), doBlur: () => dispatch(doBlurSearchInput()), }); diff --git a/src/ui/component/wunderbar/view.jsx b/src/ui/component/wunderbar/view.jsx index 12f3e240e..24830d2f4 100644 --- a/src/ui/component/wunderbar/view.jsx +++ b/src/ui/component/wunderbar/view.jsx @@ -21,7 +21,7 @@ type Props = { doFocus: () => void, doBlur: () => void, focused: boolean, - doShowSnackBar: ({}) => void, + doShowSnackBar: string => void, }; type State = { @@ -96,9 +96,7 @@ class WunderBar extends React.PureComponent { const query = value.trim(); const showSnackError = () => { - doShowSnackBar({ - message: __('Invalid LBRY URL entered. Only A-Z, a-z, 0-9, and "-" allowed.'), - }); + doShowSnackBar('Invalid LBRY URL entered. Only A-Z, a-z, 0-9, and "-" allowed.'); }; // User selected a suggestion