diff options
author | Stefan Malzner <stefan@adlk.io> | 2018-12-09 13:24:17 +0100 |
---|---|---|
committer | Stefan Malzner <stefan@adlk.io> | 2018-12-09 13:24:17 +0100 |
commit | 898d54cd0034bbb2727bc5b5eaf9d5a4f2a852de (patch) | |
tree | 9816c013f9a9453dae07d9dd8d4a862c77c23064 /src/containers | |
parent | Upgrade to react 16 (diff) | |
download | ferdium-app-898d54cd0034bbb2727bc5b5eaf9d5a4f2a852de.tar.gz ferdium-app-898d54cd0034bbb2727bc5b5eaf9d5a4f2a852de.tar.zst ferdium-app-898d54cd0034bbb2727bc5b5eaf9d5a4f2a852de.zip |
Add React 16 didCatch/ErrorBoundary component
Diffstat (limited to 'src/containers')
-rw-r--r-- | src/containers/settings/AccountScreen.js | 35 | ||||
-rw-r--r-- | src/containers/settings/EditServiceScreen.js | 32 | ||||
-rw-r--r-- | src/containers/settings/EditSettingsScreen.js | 31 | ||||
-rw-r--r-- | src/containers/settings/EditUserScreen.js | 20 | ||||
-rw-r--r-- | src/containers/settings/InviteScreen.js | 16 | ||||
-rw-r--r-- | src/containers/settings/RecipesScreen.js | 29 | ||||
-rw-r--r-- | src/containers/settings/ServicesScreen.js | 31 | ||||
-rw-r--r-- | src/containers/settings/SettingsWindow.js | 15 |
8 files changed, 118 insertions, 91 deletions
diff --git a/src/containers/settings/AccountScreen.js b/src/containers/settings/AccountScreen.js index 5818af0b1..019b3d7d6 100644 --- a/src/containers/settings/AccountScreen.js +++ b/src/containers/settings/AccountScreen.js | |||
@@ -9,6 +9,7 @@ import AppStore from '../../stores/AppStore'; | |||
9 | import { gaPage } from '../../lib/analytics'; | 9 | import { gaPage } from '../../lib/analytics'; |
10 | 10 | ||
11 | import AccountDashboard from '../../components/settings/account/AccountDashboard'; | 11 | import AccountDashboard from '../../components/settings/account/AccountDashboard'; |
12 | import ErrorBoundary from '../../components/util/ErrorBoundary'; | ||
12 | 13 | ||
13 | const { BrowserWindow } = remote; | 14 | const { BrowserWindow } = remote; |
14 | 15 | ||
@@ -67,22 +68,24 @@ export default @inject('stores', 'actions') @observer class AccountScreen extend | |||
67 | const isLoadingPlans = payment.plansRequest.isExecuting; | 68 | const isLoadingPlans = payment.plansRequest.isExecuting; |
68 | 69 | ||
69 | return ( | 70 | return ( |
70 | <AccountDashboard | 71 | <ErrorBoundary> |
71 | user={user.data} | 72 | <AccountDashboard |
72 | orders={payment.orders} | 73 | user={user.data} |
73 | isLoading={isLoadingUserInfo} | 74 | orders={payment.orders} |
74 | isLoadingOrdersInfo={isLoadingOrdersInfo} | 75 | isLoading={isLoadingUserInfo} |
75 | isLoadingPlans={isLoadingPlans} | 76 | isLoadingOrdersInfo={isLoadingOrdersInfo} |
76 | userInfoRequestFailed={user.getUserInfoRequest.wasExecuted && user.getUserInfoRequest.isError} | 77 | isLoadingPlans={isLoadingPlans} |
77 | retryUserInfoRequest={() => this.reloadData()} | 78 | userInfoRequestFailed={user.getUserInfoRequest.wasExecuted && user.getUserInfoRequest.isError} |
78 | isCreatingPaymentDashboardUrl={payment.createDashboardUrlRequest.isExecuting} | 79 | retryUserInfoRequest={() => this.reloadData()} |
79 | openDashboard={price => this.handlePaymentDashboard(price)} | 80 | isCreatingPaymentDashboardUrl={payment.createDashboardUrlRequest.isExecuting} |
80 | openExternalUrl={url => openExternalUrl({ url })} | 81 | openDashboard={price => this.handlePaymentDashboard(price)} |
81 | onCloseSubscriptionWindow={() => this.onCloseWindow()} | 82 | openExternalUrl={url => openExternalUrl({ url })} |
82 | deleteAccount={userActions.delete} | 83 | onCloseSubscriptionWindow={() => this.onCloseWindow()} |
83 | isLoadingDeleteAccount={user.deleteAccountRequest.isExecuting} | 84 | deleteAccount={userActions.delete} |
84 | isDeleteAccountSuccessful={user.deleteAccountRequest.wasExecuted && !user.deleteAccountRequest.isError} | 85 | isLoadingDeleteAccount={user.deleteAccountRequest.isExecuting} |
85 | /> | 86 | isDeleteAccountSuccessful={user.deleteAccountRequest.wasExecuted && !user.deleteAccountRequest.isError} |
87 | /> | ||
88 | </ErrorBoundary> | ||
86 | ); | 89 | ); |
87 | } | 90 | } |
88 | } | 91 | } |
diff --git a/src/containers/settings/EditServiceScreen.js b/src/containers/settings/EditServiceScreen.js index f4915f68b..f0b7268d6 100644 --- a/src/containers/settings/EditServiceScreen.js +++ b/src/containers/settings/EditServiceScreen.js | |||
@@ -13,6 +13,8 @@ import { gaPage } from '../../lib/analytics'; | |||
13 | 13 | ||
14 | import ServiceError from '../../components/settings/services/ServiceError'; | 14 | import ServiceError from '../../components/settings/services/ServiceError'; |
15 | import EditServiceForm from '../../components/settings/services/EditServiceForm'; | 15 | import EditServiceForm from '../../components/settings/services/EditServiceForm'; |
16 | import ErrorBoundary from '../../components/util/ErrorBoundary'; | ||
17 | |||
16 | import { required, url, oneRequired } from '../../helpers/validation-helpers'; | 18 | import { required, url, oneRequired } from '../../helpers/validation-helpers'; |
17 | import { getSelectOptions } from '../../helpers/i18n-helpers'; | 19 | import { getSelectOptions } from '../../helpers/i18n-helpers'; |
18 | 20 | ||
@@ -302,20 +304,22 @@ export default @inject('stores', 'actions') @observer class EditServiceScreen ex | |||
302 | const form = this.prepareForm(recipe, service, proxyFeature); | 304 | const form = this.prepareForm(recipe, service, proxyFeature); |
303 | 305 | ||
304 | return ( | 306 | return ( |
305 | <EditServiceForm | 307 | <ErrorBoundary> |
306 | action={action} | 308 | <EditServiceForm |
307 | recipe={recipe} | 309 | action={action} |
308 | service={service} | 310 | recipe={recipe} |
309 | user={user.data} | 311 | service={service} |
310 | form={form} | 312 | user={user.data} |
311 | status={services.actionStatus} | 313 | form={form} |
312 | isSaving={services.updateServiceRequest.isExecuting || services.createServiceRequest.isExecuting} | 314 | status={services.actionStatus} |
313 | isDeleting={services.deleteServiceRequest.isExecuting} | 315 | isSaving={services.updateServiceRequest.isExecuting || services.createServiceRequest.isExecuting} |
314 | onSubmit={d => this.onSubmit(d)} | 316 | isDeleting={services.deleteServiceRequest.isExecuting} |
315 | onDelete={() => this.deleteService()} | 317 | onSubmit={d => this.onSubmit(d)} |
316 | isProxyFeatureEnabled={proxyFeature.isEnabled} | 318 | onDelete={() => this.deleteService()} |
317 | isProxyFeaturePremiumFeature={proxyFeature.isPremium} | 319 | isProxyFeatureEnabled={proxyFeature.isEnabled} |
318 | /> | 320 | isProxyFeaturePremiumFeature={proxyFeature.isPremium} |
321 | /> | ||
322 | </ErrorBoundary> | ||
319 | ); | 323 | ); |
320 | } | 324 | } |
321 | } | 325 | } |
diff --git a/src/containers/settings/EditSettingsScreen.js b/src/containers/settings/EditSettingsScreen.js index 350bd9f8a..f1706a721 100644 --- a/src/containers/settings/EditSettingsScreen.js +++ b/src/containers/settings/EditSettingsScreen.js | |||
@@ -16,6 +16,7 @@ import { getSelectOptions } from '../../helpers/i18n-helpers'; | |||
16 | 16 | ||
17 | 17 | ||
18 | import EditSettingsForm from '../../components/settings/settings/EditSettingsForm'; | 18 | import EditSettingsForm from '../../components/settings/settings/EditSettingsForm'; |
19 | import ErrorBoundary from '../../components/util/ErrorBoundary'; | ||
19 | 20 | ||
20 | const messages = defineMessages({ | 21 | const messages = defineMessages({ |
21 | autoLaunchOnStart: { | 22 | autoLaunchOnStart: { |
@@ -216,20 +217,22 @@ export default @inject('stores', 'actions') @observer class EditSettingsScreen e | |||
216 | const form = this.prepareForm(); | 217 | const form = this.prepareForm(); |
217 | 218 | ||
218 | return ( | 219 | return ( |
219 | <EditSettingsForm | 220 | <ErrorBoundary> |
220 | form={form} | 221 | <EditSettingsForm |
221 | checkForUpdates={checkForUpdates} | 222 | form={form} |
222 | installUpdate={installUpdate} | 223 | checkForUpdates={checkForUpdates} |
223 | isCheckingForUpdates={updateStatus === updateStatusTypes.CHECKING} | 224 | installUpdate={installUpdate} |
224 | isUpdateAvailable={updateStatus === updateStatusTypes.AVAILABLE} | 225 | isCheckingForUpdates={updateStatus === updateStatusTypes.CHECKING} |
225 | noUpdateAvailable={updateStatus === updateStatusTypes.NOT_AVAILABLE} | 226 | isUpdateAvailable={updateStatus === updateStatusTypes.AVAILABLE} |
226 | updateIsReadyToInstall={updateStatus === updateStatusTypes.DOWNLOADED} | 227 | noUpdateAvailable={updateStatus === updateStatusTypes.NOT_AVAILABLE} |
227 | onSubmit={d => this.onSubmit(d)} | 228 | updateIsReadyToInstall={updateStatus === updateStatusTypes.DOWNLOADED} |
228 | cacheSize={cacheSize} | 229 | onSubmit={d => this.onSubmit(d)} |
229 | isClearingAllCache={isClearingAllCache} | 230 | cacheSize={cacheSize} |
230 | onClearAllCache={clearAllCache} | 231 | isClearingAllCache={isClearingAllCache} |
231 | isSpellcheckerPremiumFeature={spellcheckerConfig.isPremiumFeature} | 232 | onClearAllCache={clearAllCache} |
232 | /> | 233 | isSpellcheckerPremiumFeature={spellcheckerConfig.isPremiumFeature} |
234 | /> | ||
235 | </ErrorBoundary> | ||
233 | ); | 236 | ); |
234 | } | 237 | } |
235 | } | 238 | } |
diff --git a/src/containers/settings/EditUserScreen.js b/src/containers/settings/EditUserScreen.js index 3da3e8d2c..adad8a9bd 100644 --- a/src/containers/settings/EditUserScreen.js +++ b/src/containers/settings/EditUserScreen.js | |||
@@ -6,6 +6,8 @@ import { defineMessages, intlShape } from 'react-intl'; | |||
6 | import UserStore from '../../stores/UserStore'; | 6 | import UserStore from '../../stores/UserStore'; |
7 | import Form from '../../lib/Form'; | 7 | import Form from '../../lib/Form'; |
8 | import EditUserForm from '../../components/settings/user/EditUserForm'; | 8 | import EditUserForm from '../../components/settings/user/EditUserForm'; |
9 | import ErrorBoundary from '../../components/util/ErrorBoundary'; | ||
10 | |||
9 | import { required, email, minLength } from '../../helpers/validation-helpers'; | 11 | import { required, email, minLength } from '../../helpers/validation-helpers'; |
10 | import { gaPage } from '../../lib/analytics'; | 12 | import { gaPage } from '../../lib/analytics'; |
11 | 13 | ||
@@ -140,14 +142,16 @@ export default @inject('stores', 'actions') @observer class EditUserScreen exten | |||
140 | const form = this.prepareForm(user.data); | 142 | const form = this.prepareForm(user.data); |
141 | 143 | ||
142 | return ( | 144 | return ( |
143 | <EditUserForm | 145 | <ErrorBoundary> |
144 | // user={user.data} | 146 | <EditUserForm |
145 | status={user.actionStatus} | 147 | // user={user.data} |
146 | form={form} | 148 | status={user.actionStatus} |
147 | isEnterprise={user.data.isEnterprise} | 149 | form={form} |
148 | isSaving={user.updateUserInfoRequest.isExecuting} | 150 | isEnterprise={user.data.isEnterprise} |
149 | onSubmit={d => this.onSubmit(d)} | 151 | isSaving={user.updateUserInfoRequest.isExecuting} |
150 | /> | 152 | onSubmit={d => this.onSubmit(d)} |
153 | /> | ||
154 | </ErrorBoundary> | ||
151 | ); | 155 | ); |
152 | } | 156 | } |
153 | } | 157 | } |
diff --git a/src/containers/settings/InviteScreen.js b/src/containers/settings/InviteScreen.js index 38ca6ec74..cd36610e4 100644 --- a/src/containers/settings/InviteScreen.js +++ b/src/containers/settings/InviteScreen.js | |||
@@ -3,6 +3,8 @@ import PropTypes from 'prop-types'; | |||
3 | import { inject, observer } from 'mobx-react'; | 3 | import { inject, observer } from 'mobx-react'; |
4 | 4 | ||
5 | import Invite from '../../components/auth/Invite'; | 5 | import Invite from '../../components/auth/Invite'; |
6 | import ErrorBoundary from '../../components/util/ErrorBoundary'; | ||
7 | |||
6 | import { gaPage } from '../../lib/analytics'; | 8 | import { gaPage } from '../../lib/analytics'; |
7 | 9 | ||
8 | export default @inject('stores', 'actions') @observer class InviteScreen extends Component { | 10 | export default @inject('stores', 'actions') @observer class InviteScreen extends Component { |
@@ -19,12 +21,14 @@ export default @inject('stores', 'actions') @observer class InviteScreen extends | |||
19 | const { user } = this.props.stores; | 21 | const { user } = this.props.stores; |
20 | 22 | ||
21 | return ( | 23 | return ( |
22 | <Invite | 24 | <ErrorBoundary> |
23 | onSubmit={actions.user.invite} | 25 | <Invite |
24 | isLoadingInvite={user.inviteRequest.isExecuting} | 26 | onSubmit={actions.user.invite} |
25 | isInviteSuccessful={user.inviteRequest.wasExecuted && !user.inviteRequest.isError} | 27 | isLoadingInvite={user.inviteRequest.isExecuting} |
26 | embed | 28 | isInviteSuccessful={user.inviteRequest.wasExecuted && !user.inviteRequest.isError} |
27 | /> | 29 | embed |
30 | /> | ||
31 | </ErrorBoundary> | ||
28 | ); | 32 | ); |
29 | } | 33 | } |
30 | } | 34 | } |
diff --git a/src/containers/settings/RecipesScreen.js b/src/containers/settings/RecipesScreen.js index b125e6a05..1f05b6510 100644 --- a/src/containers/settings/RecipesScreen.js +++ b/src/containers/settings/RecipesScreen.js | |||
@@ -10,6 +10,7 @@ import UserStore from '../../stores/UserStore'; | |||
10 | import { gaPage } from '../../lib/analytics'; | 10 | import { gaPage } from '../../lib/analytics'; |
11 | 11 | ||
12 | import RecipesDashboard from '../../components/settings/recipes/RecipesDashboard'; | 12 | import RecipesDashboard from '../../components/settings/recipes/RecipesDashboard'; |
13 | import ErrorBoundary from '../../components/util/ErrorBoundary'; | ||
13 | 14 | ||
14 | export default @inject('stores', 'actions') @observer class RecipesScreen extends Component { | 15 | export default @inject('stores', 'actions') @observer class RecipesScreen extends Component { |
15 | static propTypes = { | 16 | static propTypes = { |
@@ -93,19 +94,21 @@ export default @inject('stores', 'actions') @observer class RecipesScreen extend | |||
93 | || recipePreviews.searchRecipePreviewsRequest.isExecuting; | 94 | || recipePreviews.searchRecipePreviewsRequest.isExecuting; |
94 | 95 | ||
95 | return ( | 96 | return ( |
96 | <RecipesDashboard | 97 | <ErrorBoundary> |
97 | recipes={allRecipes} | 98 | <RecipesDashboard |
98 | isLoading={isLoading} | 99 | recipes={allRecipes} |
99 | addedServiceCount={services.all.length} | 100 | isLoading={isLoading} |
100 | isPremium={user.data.isPremium} | 101 | addedServiceCount={services.all.length} |
101 | hasLoadedRecipes={recipePreviews.featuredRecipePreviewsRequest.wasExecuted} | 102 | isPremium={user.data.isPremium} |
102 | showAddServiceInterface={showAddServiceInterface} | 103 | hasLoadedRecipes={recipePreviews.featuredRecipePreviewsRequest.wasExecuted} |
103 | searchRecipes={e => this.searchRecipes(e)} | 104 | showAddServiceInterface={showAddServiceInterface} |
104 | resetSearch={() => this.resetSearch()} | 105 | searchRecipes={e => this.searchRecipes(e)} |
105 | searchNeedle={this.state.needle} | 106 | resetSearch={() => this.resetSearch()} |
106 | serviceStatus={services.actionStatus} | 107 | searchNeedle={this.state.needle} |
107 | devRecipesCount={recipePreviews.dev.length} | 108 | serviceStatus={services.actionStatus} |
108 | /> | 109 | devRecipesCount={recipePreviews.dev.length} |
110 | /> | ||
111 | </ErrorBoundary> | ||
109 | ); | 112 | ); |
110 | } | 113 | } |
111 | } | 114 | } |
diff --git a/src/containers/settings/ServicesScreen.js b/src/containers/settings/ServicesScreen.js index c1a133ef7..b70a5506e 100644 --- a/src/containers/settings/ServicesScreen.js +++ b/src/containers/settings/ServicesScreen.js | |||
@@ -9,6 +9,7 @@ import ServiceStore from '../../stores/ServicesStore'; | |||
9 | import { gaPage } from '../../lib/analytics'; | 9 | import { gaPage } from '../../lib/analytics'; |
10 | 10 | ||
11 | import ServicesDashboard from '../../components/settings/services/ServicesDashboard'; | 11 | import ServicesDashboard from '../../components/settings/services/ServicesDashboard'; |
12 | import ErrorBoundary from '../../components/util/ErrorBoundary'; | ||
12 | 13 | ||
13 | export default @inject('stores', 'actions') @observer class ServicesScreen extends Component { | 14 | export default @inject('stores', 'actions') @observer class ServicesScreen extends Component { |
14 | componentDidMount() { | 15 | componentDidMount() { |
@@ -40,20 +41,22 @@ export default @inject('stores', 'actions') @observer class ServicesScreen exten | |||
40 | } | 41 | } |
41 | 42 | ||
42 | return ( | 43 | return ( |
43 | <ServicesDashboard | 44 | <ErrorBoundary> |
44 | user={user.data} | 45 | <ServicesDashboard |
45 | services={allServices} | 46 | user={user.data} |
46 | status={services.actionStatus} | 47 | services={allServices} |
47 | deleteService={() => this.deleteService()} | 48 | status={services.actionStatus} |
48 | toggleService={toggleService} | 49 | deleteService={() => this.deleteService()} |
49 | isLoading={isLoading} | 50 | toggleService={toggleService} |
50 | filterServices={filter} | 51 | isLoading={isLoading} |
51 | resetFilter={resetFilter} | 52 | filterServices={filter} |
52 | goTo={router.push} | 53 | resetFilter={resetFilter} |
53 | servicesRequestFailed={services.allServicesRequest.wasExecuted && services.allServicesRequest.isError} | 54 | goTo={router.push} |
54 | retryServicesRequest={() => services.allServicesRequest.reload()} | 55 | servicesRequestFailed={services.allServicesRequest.wasExecuted && services.allServicesRequest.isError} |
55 | searchNeedle={services.filterNeedle} | 56 | retryServicesRequest={() => services.allServicesRequest.reload()} |
56 | /> | 57 | searchNeedle={services.filterNeedle} |
58 | /> | ||
59 | </ErrorBoundary> | ||
57 | ); | 60 | ); |
58 | } | 61 | } |
59 | } | 62 | } |
diff --git a/src/containers/settings/SettingsWindow.js b/src/containers/settings/SettingsWindow.js index 55589d0be..6d9e0ee77 100644 --- a/src/containers/settings/SettingsWindow.js +++ b/src/containers/settings/SettingsWindow.js | |||
@@ -6,6 +6,7 @@ import ServicesStore from '../../stores/ServicesStore'; | |||
6 | 6 | ||
7 | import Layout from '../../components/settings/SettingsLayout'; | 7 | import Layout from '../../components/settings/SettingsLayout'; |
8 | import Navigation from '../../components/settings/navigation/SettingsNavigation'; | 8 | import Navigation from '../../components/settings/navigation/SettingsNavigation'; |
9 | import ErrorBoundary from '../../components/util/ErrorBoundary'; | ||
9 | 10 | ||
10 | export default @inject('stores', 'actions') @observer class SettingsContainer extends Component { | 11 | export default @inject('stores', 'actions') @observer class SettingsContainer extends Component { |
11 | render() { | 12 | render() { |
@@ -19,12 +20,14 @@ export default @inject('stores', 'actions') @observer class SettingsContainer ex | |||
19 | ); | 20 | ); |
20 | 21 | ||
21 | return ( | 22 | return ( |
22 | <Layout | 23 | <ErrorBoundary> |
23 | navigation={navigation} | 24 | <Layout |
24 | closeSettings={closeSettings} | 25 | navigation={navigation} |
25 | > | 26 | closeSettings={closeSettings} |
26 | {children} | 27 | > |
27 | </Layout> | 28 | {children} |
29 | </Layout> | ||
30 | </ErrorBoundary> | ||
28 | ); | 31 | ); |
29 | } | 32 | } |
30 | } | 33 | } |