Prevent autocomplete crash (#878)

* prevent crashing

* sourcemap cleanup
pull/875/head^2
Bruno Barbieri 4 years ago committed by GitHub
parent b29ca90431
commit 267f082236
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      app/components/UI/UrlAutocomplete/index.js
  2. 4
      package.json
  3. 11
      sourcemaps/trace.txt

@ -7,6 +7,7 @@ import { connect } from 'react-redux';
import WebsiteIcon from '../WebsiteIcon';
import { colors, fontStyles } from '../../../styles/common';
import { getHost } from '../../../util/browser';
import Logger from '../../../util/Logger';
const styles = StyleSheet.create({
wrapper: {
@ -115,7 +116,11 @@ class UrlAutocomplete extends PureComponent {
this.timer = setTimeout(() => {
const fuseSearchResult = this.fuse.search(this.props.input);
this.updateResults([...fuseSearchResult]);
if (Array.isArray(fuseSearchResult)) {
this.updateResults([...fuseSearchResult]);
} else {
this.updateResults([]);
}
}, 500);
}
}
@ -125,7 +130,11 @@ class UrlAutocomplete extends PureComponent {
}
updateResults(results) {
this.mounted && this.setState({ results });
try {
this.mounted && this.setState({ results });
} catch (e) {
Logger.error('Autocomplete crash', results);
}
}
onSubmitInput = () => this.props.onSubmit(this.props.input);

@ -28,8 +28,8 @@
"postinstall": "./scripts/postinstall.sh",
"sourcemaps:android": "node_modules/.bin/react-native bundle --platform android --entry-file index.js --dev false --reset-cache --bundle-output /tmp/bundle.android.js --assets-dest /tmp/ --sourcemap-output sourcemaps/android/index.js.map",
"sourcemaps:ios": "node_modules/.bin/react-native bundle --platform ios --entry-file index.js --dev false --reset-cache --bundle-output /tmp/bundle.ios.js --assets-dest /tmp/ --sourcemap-output sourcemaps/ios/index.js.map",
"stacktrace:android": "stack-beautifier sourcemaps/android.js.map -t trace.txt",
"stacktrace:ios": "stack-beautifier sourcemaps/ios.js.map -t trace.txt"
"stacktrace:android": "stack-beautifier sourcemaps/android/index.js.map -t sourcemaps/trace.txt",
"stacktrace:ios": "stack-beautifier sourcemaps/ios/index.js.map -t sourcemaps/trace.txt"
},
"prettier": {
"printWidth": 120,

@ -1 +1,10 @@
# PASTE THE MINIFIED JS STACKTRACE HERE
# EXAMPLE stacktrace below:
Fatal Exception: com.facebook.react.common.JavascriptException: Invalid attempt to destructure non-iterable instance, stack:
<unknown>@9:487
o@781:121
value@80:1312
value@42:1514
<unknown>@18:912
d@31:10
value@11:1512

Loading…
Cancel
Save