From 26caa13b5fec6779ebf744792d08bf72981af62d Mon Sep 17 00:00:00 2001 From: SleepWalker Date: Mon, 2 Jan 2017 15:37:02 +0200 Subject: [PATCH] Minor fixes --- src/components/profile/Profile.jsx | 4 +++- src/components/ui/scrollTo.js | 5 ----- src/pages/profile/ChangeUsernamePage.jsx | 5 ++--- src/services/logger.js | 13 +++++++++---- webpack.config.js | 2 +- 5 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/components/profile/Profile.jsx b/src/components/profile/Profile.jsx index cece595..9c93f30 100644 --- a/src/components/profile/Profile.jsx +++ b/src/components/profile/Profile.jsx @@ -121,7 +121,9 @@ export default class Profile extends Component { range.selectNodeContents(this.UUID); selection.removeAllRanges(); selection.addRange(range); - } catch (err) {} + } catch (err) { + // the browser does not support an API + } } setUUID(el) { diff --git a/src/components/ui/scrollTo.js b/src/components/ui/scrollTo.js index ab84eb7..25092f9 100644 --- a/src/components/ui/scrollTo.js +++ b/src/components/ui/scrollTo.js @@ -33,11 +33,6 @@ export default function scrollTo(y, viewPort) { const newScrollTop = y + delta; viewPort.scrollTop = newScrollTop; - - if (viewPort.scrollTop === 0) { - scrollWasTouched = true; - console.warn('The viewPort is not scrollable', viewPort); - } }()); }); diff --git a/src/pages/profile/ChangeUsernamePage.jsx b/src/pages/profile/ChangeUsernamePage.jsx index 103f695..70bdf6e 100644 --- a/src/pages/profile/ChangeUsernamePage.jsx +++ b/src/pages/profile/ChangeUsernamePage.jsx @@ -53,6 +53,7 @@ class ChangeUsernamePage extends Component { sendData: () => accounts.changeUsername(form.serialize()) }).then(() => { this.actualUsername = form.value('username'); + this.context.goToProfile(); }); }; @@ -64,7 +65,5 @@ import { updateUser } from 'components/user/actions'; export default connect((state) => ({ username: state.user.username }), { - updateUsername: (username) => { - return updateUser({username}); - } + updateUsername: (username) => updateUser({username}) })(ChangeUsernamePage); diff --git a/src/services/logger.js b/src/services/logger.js index 06d8643..9def95f 100644 --- a/src/services/logger.js +++ b/src/services/logger.js @@ -21,9 +21,14 @@ const logger = { } }).install(); - window.addEventListener('unhandledrejection', - (event) => Raven.captureException(event.reason) - ); + window.addEventListener('unhandledrejection', (event) => { + const error = event.reason || {}; + const message = error.message ? `: ${error.message}` : ''; + + logger.info(`Unhandled rejection${message}`, { + error + }); + }); } }, @@ -50,7 +55,7 @@ const logger = { return; } - console[method](message, context); + console[method](message, context); // eslint-disable-line Raven.captureException(message, { level, diff --git a/webpack.config.js b/webpack.config.js index c6b6be0..a9f8c8c 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -120,7 +120,7 @@ const webpackConfig = { new HtmlWebpackPlugin({ template: 'src/index.ejs', favicon: 'src/favicon.ico', - scripts: isProduction ? [] : ['dll/vendor.dll.js'], + scripts: isProduction ? [] : ['/dll/vendor.dll.js'], hash: false, // webpack does this for all our assets automagically filename: 'index.html', inject: false,