mirror of
https://github.com/balena-io/etcher.git
synced 2025-07-19 09:16:38 +00:00
fix(GUI): ensure settings are loaded before bootstrapping application (#1879)
We load localStorage settings into the Redux store in an asynchronous way. This means that user settings might not be loaded by the time the application starts, resulting in Mixpanel sending a few tracking events before Etcher realises that the user opted out from anonoymous analytics and error reporting. In order to fix that, we remove `ng-app` and we manually bootstrap the Angular.js application *after* the local settings are loaded. Change-Type: patch Changelog-Entry: Don't send initial Mixpanel events before "Anonymous Tracking" settings are loaded. Fixes: https://github.com/resin-io/etcher/issues/1772 Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
This commit is contained in:
parent
19b7ce0668
commit
618440e38f
@ -102,7 +102,6 @@ app.run(() => {
|
||||
version: currentVersion
|
||||
})
|
||||
|
||||
settings.load().then(() => {
|
||||
const shouldCheckForUpdates = updateNotifier.shouldCheckForUpdates({
|
||||
currentVersion,
|
||||
lastSleptUpdateNotifier: settings.get('lastSleptUpdateNotifier'),
|
||||
@ -173,7 +172,6 @@ app.run(() => {
|
||||
title: errors.getTitle(error),
|
||||
description: errors.getDescription(error)
|
||||
})
|
||||
})
|
||||
}).catch(exceptionReporter.report)
|
||||
})
|
||||
|
||||
@ -347,3 +345,11 @@ app.controller('StateController', function ($rootScope, $scope) {
|
||||
*/
|
||||
this.currentName = null
|
||||
})
|
||||
|
||||
// Ensure user settings are loaded before
|
||||
// we bootstrap the Angular.js application
|
||||
angular.element(document).ready(() => {
|
||||
settings.load().then(() => {
|
||||
angular.bootstrap(document, [ 'Etcher' ])
|
||||
}).catch(exceptionReporter.report)
|
||||
})
|
||||
|
@ -8,7 +8,7 @@
|
||||
<link rel="stylesheet" type="text/css" href="css/angular.css">
|
||||
<script src="./app.js"></script>
|
||||
</head>
|
||||
<body ng-app="Etcher">
|
||||
<body>
|
||||
<header class="section-header" ng-controller="HeaderController as header">
|
||||
<button class="button button-link"
|
||||
ng-click="header.openHelpPage()"
|
||||
|
Loading…
x
Reference in New Issue
Block a user