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.groups',
'company.company_gateways.gateway', 'company.company_gateways.gateway',
'company.clients', 'company.clients',
'company.products', //'company.products',
'company.invoices', //'company.invoices',
'company.payments', //'company.payments',
'company.quotes', //'company.quotes',
//'company.credits', //'company.credits',
//'company.tasks', //'company.tasks',
//'company.projects', //'company.projects',

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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