From 06890afbd50c47a18e26f7a9685d08ea11319cd8 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Thu, 14 May 2020 23:53:04 +0300 Subject: [PATCH] Web performance fix --- lib/redux/app/app_actions.dart | 5 ++--- lib/redux/app/app_reducer.dart | 1 + lib/redux/client/client_actions.dart | 3 ++- lib/redux/company_gateway/company_gateway_actions.dart | 2 +- lib/redux/credit/credit_actions.dart | 2 +- lib/redux/design/design_actions.dart | 2 +- lib/redux/document/document_actions.dart | 2 +- lib/redux/expense/expense_actions.dart | 2 +- lib/redux/group/group_actions.dart | 2 +- lib/redux/invoice/invoice_actions.dart | 2 +- lib/redux/payment/payment_actions.dart | 2 +- lib/redux/product/product_actions.dart | 3 ++- lib/redux/project/project_actions.dart | 2 +- lib/redux/quote/quote_actions.dart | 2 +- lib/redux/task/task_actions.dart | 2 +- lib/redux/tax_rate/tax_rate_actions.dart | 2 +- lib/redux/user/user_actions.dart | 2 +- lib/redux/vendor/vendor_actions.dart | 2 +- stubs/redux/stub/stub_actions | 2 +- 19 files changed, 22 insertions(+), 20 deletions(-) diff --git a/lib/redux/app/app_actions.dart b/lib/redux/app/app_actions.dart index a32f168eb..c26d26f8b 100644 --- a/lib/redux/app/app_actions.dart +++ b/lib/redux/app/app_actions.dart @@ -281,7 +281,6 @@ void viewEntitiesByType({ break; case EntityType.user: action = ViewUserList(navigator: navigator); - break; case EntityType.project: action = ViewProjectList(navigator: navigator); @@ -326,8 +325,8 @@ void viewEntitiesByType({ } if (action != null) { - if (kIsWeb && !isNotMobile(context)) { - store.dispatch(UpdateCurrentRoute('/blank')); + if (kIsWeb && isNotMobile(context)) { + store.dispatch(StartLoading()); WidgetsBinding.instance.addPostFrameCallback((duration) { store.dispatch(action); }); diff --git a/lib/redux/app/app_reducer.dart b/lib/redux/app/app_reducer.dart index 85db69008..b833ff4b1 100644 --- a/lib/redux/app/app_reducer.dart +++ b/lib/redux/app/app_reducer.dart @@ -49,6 +49,7 @@ AppState appReducer(AppState state, dynamic action) { state.prefState, action, state.uiState.selectedCompanyIndex))); } + final lastErrorReducer = combineReducers([ TypedReducer((state, action) { return ''; diff --git a/lib/redux/client/client_actions.dart b/lib/redux/client/client_actions.dart index 791bb106b..371a3cf2a 100644 --- a/lib/redux/client/client_actions.dart +++ b/lib/redux/client/client_actions.dart @@ -11,7 +11,8 @@ import 'package:invoiceninja_flutter/utils/completers.dart'; import 'package:invoiceninja_flutter/utils/localization.dart'; import 'package:invoiceninja_flutter/utils/platforms.dart'; -class ViewClientList extends AbstractNavigatorAction implements PersistUI { +class ViewClientList extends AbstractNavigatorAction + implements PersistUI, StopLoading { ViewClientList({ @required NavigatorState navigator, this.force = false, diff --git a/lib/redux/company_gateway/company_gateway_actions.dart b/lib/redux/company_gateway/company_gateway_actions.dart index 57d37de0a..e8254fe0d 100644 --- a/lib/redux/company_gateway/company_gateway_actions.dart +++ b/lib/redux/company_gateway/company_gateway_actions.dart @@ -11,7 +11,7 @@ import 'package:invoiceninja_flutter/utils/completers.dart'; import 'package:invoiceninja_flutter/utils/localization.dart'; class ViewCompanyGatewayList extends AbstractNavigatorAction - implements PersistUI { + implements PersistUI, StopLoading { ViewCompanyGatewayList( {@required NavigatorState navigator, this.force = false}) : super(navigator: navigator); diff --git a/lib/redux/credit/credit_actions.dart b/lib/redux/credit/credit_actions.dart index d49abb048..3a53d5c20 100644 --- a/lib/redux/credit/credit_actions.dart +++ b/lib/redux/credit/credit_actions.dart @@ -12,7 +12,7 @@ import 'package:invoiceninja_flutter/utils/localization.dart'; import 'package:invoiceninja_flutter/utils/pdf.dart'; import 'package:url_launcher/url_launcher.dart'; -class ViewCreditList extends AbstractNavigatorAction implements PersistUI { +class ViewCreditList extends AbstractNavigatorAction implements PersistUI, StopLoading { ViewCreditList({@required NavigatorState navigator, this.force = false}) : super(navigator: navigator); diff --git a/lib/redux/design/design_actions.dart b/lib/redux/design/design_actions.dart index f95c37a1a..d1fc251b3 100644 --- a/lib/redux/design/design_actions.dart +++ b/lib/redux/design/design_actions.dart @@ -8,7 +8,7 @@ import 'package:invoiceninja_flutter/redux/app/app_state.dart'; import 'package:invoiceninja_flutter/utils/completers.dart'; import 'package:invoiceninja_flutter/utils/localization.dart'; -class ViewDesignList extends AbstractNavigatorAction implements PersistUI { +class ViewDesignList extends AbstractNavigatorAction implements PersistUI, StopLoading { ViewDesignList({ @required NavigatorState navigator, this.force = false, diff --git a/lib/redux/document/document_actions.dart b/lib/redux/document/document_actions.dart index 12b1b27ce..d207376fb 100644 --- a/lib/redux/document/document_actions.dart +++ b/lib/redux/document/document_actions.dart @@ -9,7 +9,7 @@ import 'package:invoiceninja_flutter/redux/app/app_state.dart'; import 'package:invoiceninja_flutter/utils/completers.dart'; import 'package:invoiceninja_flutter/utils/localization.dart'; -class ViewDocumentList extends AbstractNavigatorAction implements PersistUI { +class ViewDocumentList extends AbstractNavigatorAction implements PersistUI, StopLoading { ViewDocumentList({@required NavigatorState navigator, this.force = false}) : super(navigator: navigator); diff --git a/lib/redux/expense/expense_actions.dart b/lib/redux/expense/expense_actions.dart index 1f3583aa5..1d8aa8915 100644 --- a/lib/redux/expense/expense_actions.dart +++ b/lib/redux/expense/expense_actions.dart @@ -11,7 +11,7 @@ import 'package:invoiceninja_flutter/redux/expense/expense_selectors.dart'; import 'package:invoiceninja_flutter/utils/completers.dart'; import 'package:invoiceninja_flutter/utils/localization.dart'; -class ViewExpenseList extends AbstractNavigatorAction implements PersistUI { +class ViewExpenseList extends AbstractNavigatorAction implements PersistUI, StopLoading { ViewExpenseList({@required NavigatorState navigator, this.force = false}) : super(navigator: navigator); diff --git a/lib/redux/group/group_actions.dart b/lib/redux/group/group_actions.dart index 8e3024c4b..4227cf7fa 100644 --- a/lib/redux/group/group_actions.dart +++ b/lib/redux/group/group_actions.dart @@ -12,7 +12,7 @@ import 'package:invoiceninja_flutter/redux/settings/settings_actions.dart'; import 'package:invoiceninja_flutter/utils/completers.dart'; import 'package:invoiceninja_flutter/utils/localization.dart'; -class ViewGroupList extends AbstractNavigatorAction implements PersistUI { +class ViewGroupList extends AbstractNavigatorAction implements PersistUI, StopLoading { ViewGroupList({@required NavigatorState navigator, this.force = false}) : super(navigator: navigator); diff --git a/lib/redux/invoice/invoice_actions.dart b/lib/redux/invoice/invoice_actions.dart index 5ae43ddd9..ba7aa8aac 100644 --- a/lib/redux/invoice/invoice_actions.dart +++ b/lib/redux/invoice/invoice_actions.dart @@ -11,7 +11,7 @@ import 'package:invoiceninja_flutter/utils/localization.dart'; import 'package:invoiceninja_flutter/utils/pdf.dart'; import 'package:url_launcher/url_launcher.dart'; -class ViewInvoiceList extends AbstractNavigatorAction implements PersistUI { +class ViewInvoiceList extends AbstractNavigatorAction implements PersistUI, StopLoading { ViewInvoiceList({@required NavigatorState navigator, this.force = false}) : super(navigator: navigator); diff --git a/lib/redux/payment/payment_actions.dart b/lib/redux/payment/payment_actions.dart index 9a5b0f83c..af6b14fc0 100644 --- a/lib/redux/payment/payment_actions.dart +++ b/lib/redux/payment/payment_actions.dart @@ -10,7 +10,7 @@ import 'package:invoiceninja_flutter/redux/app/app_state.dart'; import 'package:invoiceninja_flutter/utils/completers.dart'; import 'package:invoiceninja_flutter/utils/localization.dart'; -class ViewPaymentList extends AbstractNavigatorAction implements PersistUI { +class ViewPaymentList extends AbstractNavigatorAction implements PersistUI, StopLoading { ViewPaymentList({@required NavigatorState navigator, this.force = false}) : super(navigator: navigator); diff --git a/lib/redux/product/product_actions.dart b/lib/redux/product/product_actions.dart index 6ce80bdff..b60cfd09f 100644 --- a/lib/redux/product/product_actions.dart +++ b/lib/redux/product/product_actions.dart @@ -10,7 +10,8 @@ import 'package:invoiceninja_flutter/redux/product/product_selectors.dart'; import 'package:invoiceninja_flutter/utils/completers.dart'; import 'package:invoiceninja_flutter/utils/localization.dart'; -class ViewProductList extends AbstractNavigatorAction implements PersistUI { +class ViewProductList extends AbstractNavigatorAction + implements PersistUI, StopLoading { ViewProductList({@required NavigatorState navigator, this.force = false}) : super(navigator: navigator); diff --git a/lib/redux/project/project_actions.dart b/lib/redux/project/project_actions.dart index e8a3da226..aadf5c2dc 100644 --- a/lib/redux/project/project_actions.dart +++ b/lib/redux/project/project_actions.dart @@ -11,7 +11,7 @@ import 'package:invoiceninja_flutter/redux/project/project_selectors.dart'; import 'package:invoiceninja_flutter/utils/completers.dart'; import 'package:invoiceninja_flutter/utils/localization.dart'; -class ViewProjectList extends AbstractNavigatorAction implements PersistUI { +class ViewProjectList extends AbstractNavigatorAction implements PersistUI, StopLoading { ViewProjectList({@required NavigatorState navigator, this.force = false}) : super(navigator: navigator); diff --git a/lib/redux/quote/quote_actions.dart b/lib/redux/quote/quote_actions.dart index 025f18f2c..1187e4406 100644 --- a/lib/redux/quote/quote_actions.dart +++ b/lib/redux/quote/quote_actions.dart @@ -12,7 +12,7 @@ import 'package:invoiceninja_flutter/utils/localization.dart'; import 'package:invoiceninja_flutter/utils/pdf.dart'; import 'package:url_launcher/url_launcher.dart'; -class ViewQuoteList extends AbstractNavigatorAction implements PersistUI { +class ViewQuoteList extends AbstractNavigatorAction implements PersistUI, StopLoading { ViewQuoteList({@required NavigatorState navigator, this.force = false}) : super(navigator: navigator); diff --git a/lib/redux/task/task_actions.dart b/lib/redux/task/task_actions.dart index bf65531b0..e4b3810b8 100644 --- a/lib/redux/task/task_actions.dart +++ b/lib/redux/task/task_actions.dart @@ -13,7 +13,7 @@ import 'package:invoiceninja_flutter/ui/app/snackbar_row.dart'; import 'package:invoiceninja_flutter/utils/completers.dart'; import 'package:invoiceninja_flutter/utils/localization.dart'; -class ViewTaskList extends AbstractNavigatorAction implements PersistUI { +class ViewTaskList extends AbstractNavigatorAction implements PersistUI, StopLoading { ViewTaskList({@required NavigatorState navigator, this.force = false}) : super(navigator: navigator); diff --git a/lib/redux/tax_rate/tax_rate_actions.dart b/lib/redux/tax_rate/tax_rate_actions.dart index 7406eee41..49c296398 100644 --- a/lib/redux/tax_rate/tax_rate_actions.dart +++ b/lib/redux/tax_rate/tax_rate_actions.dart @@ -9,7 +9,7 @@ import 'package:invoiceninja_flutter/redux/app/app_state.dart'; import 'package:invoiceninja_flutter/utils/localization.dart'; import 'package:invoiceninja_flutter/utils/completers.dart'; -class ViewTaxRateList extends AbstractNavigatorAction implements PersistUI { +class ViewTaxRateList extends AbstractNavigatorAction implements PersistUI, StopLoading { ViewTaxRateList({@required NavigatorState navigator, this.force = false}) : super(navigator: navigator); diff --git a/lib/redux/user/user_actions.dart b/lib/redux/user/user_actions.dart index af2002e9c..00365dc33 100644 --- a/lib/redux/user/user_actions.dart +++ b/lib/redux/user/user_actions.dart @@ -10,7 +10,7 @@ import 'package:invoiceninja_flutter/utils/dialogs.dart'; import 'package:invoiceninja_flutter/utils/localization.dart'; import 'package:invoiceninja_flutter/utils/completers.dart'; -class ViewUserList extends AbstractNavigatorAction implements PersistUI { +class ViewUserList extends AbstractNavigatorAction implements PersistUI, StopLoading { ViewUserList({@required NavigatorState navigator, this.force = false}) : super(navigator: navigator); diff --git a/lib/redux/vendor/vendor_actions.dart b/lib/redux/vendor/vendor_actions.dart index 73378e9cb..7e6fb8a99 100644 --- a/lib/redux/vendor/vendor_actions.dart +++ b/lib/redux/vendor/vendor_actions.dart @@ -10,7 +10,7 @@ import 'package:invoiceninja_flutter/utils/completers.dart'; import 'package:invoiceninja_flutter/utils/localization.dart'; import 'package:invoiceninja_flutter/utils/platforms.dart'; -class ViewVendorList extends AbstractNavigatorAction implements PersistUI { +class ViewVendorList extends AbstractNavigatorAction implements PersistUI, StopLoading { ViewVendorList({@required NavigatorState navigator, this.force = false}) : super(navigator: navigator); diff --git a/stubs/redux/stub/stub_actions b/stubs/redux/stub/stub_actions index f9debe05d..b773a767a 100644 --- a/stubs/redux/stub/stub_actions +++ b/stubs/redux/stub/stub_actions @@ -11,7 +11,7 @@ import 'package:invoiceninja_flutter/utils/completers.dart'; import 'package:invoiceninja_flutter/utils/localization.dart'; import 'package:invoiceninja_flutter/utils/platforms.dart'; -class ViewStubList extends AbstractNavigatorAction implements PersistUI { +class ViewStubList extends AbstractNavigatorAction implements PersistUI, StopLoading { ViewStubList({ @required NavigatorState navigator, this.force = false,