Improve loading

This commit is contained in:
Hillel Coren 2019-12-24 23:17:43 +02:00
parent e5205a830e
commit f7ae87b158
11 changed files with 14 additions and 14 deletions

View File

@ -102,10 +102,10 @@ class AuthRepository {
'company.groups',
'company.company_gateways.gateway',
'company.clients',
'company.products',
'company.invoices',
'company.payments',
'company.quotes',
//'company.products',
//'company.invoices',
//'company.payments',
//'company.quotes',
//'company.credits',
//'company.tasks',
//'company.projects',

View File

@ -350,7 +350,7 @@ ClientState _setLoadedClients(
ClientState _companyLoaded(
ClientState clientState, LoadCompanySuccess action) {
final clients = action.userCompany.company.clients;
if (clients.isEmpty) {
if (clients == null || clients.isEmpty) {
return clientState;
}
return clientState.loadClients(clients);

View File

@ -306,7 +306,7 @@ ExpenseState _setLoadedExpenses(
ExpenseState _companyLoaded(
ExpenseState expenseState, LoadCompanySuccess action) {
final expenses = action.userCompany.company.expenses;
if (expenses.isEmpty) {
if (expenses == null || expenses.isEmpty) {
return expenseState;
}
return expenseState.loadExpenses(expenses);

View File

@ -409,7 +409,7 @@ InvoiceState _setLoadedInvoices(
InvoiceState _companyLoaded(
InvoiceState invoiceState, LoadCompanySuccess action) {
final invoices = action.userCompany.company.invoices;
if (invoices.isEmpty) {
if (invoices == null || invoices.isEmpty) {
return invoiceState;
}
return invoiceState.loadInvoices(invoices);

View File

@ -295,7 +295,7 @@ PaymentState _setLoadedPayments(
PaymentState _companyLoaded(
PaymentState paymentState, LoadCompanySuccess action) {
final payments = action.userCompany.company.payments;
if (payments.isEmpty) {
if (payments == null || payments.isEmpty) {
return paymentState;
}
return paymentState.loadPayments(payments);

View File

@ -289,7 +289,7 @@ ProductState _setLoadedProducts(
ProductState _companyLoaded(
ProductState productState, LoadCompanySuccess action) {
final products = action.userCompany.company.products;
if (products.isEmpty) {
if (products == null || products.isEmpty) {
return productState;
}
return productState.loadProducts(products);

View File

@ -312,7 +312,7 @@ ProjectState _setLoadedProjects(
ProjectState _companyLoaded(
ProjectState projectState, LoadCompanySuccess action) {
final projects = action.userCompany.company.projects;
if (projects.isEmpty) {
if (projects == null || projects.isEmpty) {
return projectState;
}
return projectState.loadProjects(projects);

View File

@ -378,7 +378,7 @@ QuoteState _setLoadedQuotes(QuoteState quoteState, LoadQuotesSuccess action) =>
QuoteState _companyLoaded(
QuoteState quoteState, LoadCompanySuccess action) {
final quotes = action.userCompany.company.quotes;
if (quotes.isEmpty) {
if (quotes == null || quotes.isEmpty) {
return quoteState;
}
return quoteState.loadQuotes(quotes);

View File

@ -288,7 +288,7 @@ TaskState _setLoadedTasks(TaskState taskState, LoadTasksSuccess action) =>
TaskState _companyLoaded(
TaskState taskState, LoadCompanySuccess action) {
final tasks = action.userCompany.company.tasks;
if (tasks.isEmpty) {
if (tasks == null || tasks.isEmpty) {
return taskState;
}
return taskState.loadTasks(tasks);

View File

@ -334,7 +334,7 @@ VendorState _setLoadedVendors(
VendorState _companyLoaded(
VendorState vendorState, LoadCompanySuccess action) {
final vendors = action.userCompany.company.vendors;
if (vendors.isEmpty) {
if (vendors == null || vendors.isEmpty) {
return vendorState;
}
return vendorState.loadVendors(vendors);

View File

@ -226,7 +226,7 @@ StubState _setLoadedStubs(
StubState _companyLoaded(
StubState stubState, LoadCompanySuccess action) {
final stubs = action.userCompany.company.stubs;
if (stubs.isEmpty) {
if (stubs == null || stubs.isEmpty) {
return stubState;
}
return stubState.loadStubs(stubs);