Skip to content

Commit

Permalink
fix(com): separate complete render content
Browse files Browse the repository at this point in the history
Co-authored-by: Mohammad Honarvar <honarvar.info@gmail.com>
Co-authored-by: S. Amir Mohammad Najafi <njfamirm@gmail.com>
  • Loading branch information
3 people committed Mar 19, 2023
1 parent 3c13f4e commit 06a94f1
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions uniquely/com-pwa/src/ui/page/order-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,26 +116,30 @@ export class AlwatrPageOrderList extends ScheduleUpdateToFrameMixin(
`;
},

reloading: 'complete',
reloadingFailed: 'complete',
reloading: 'complete',
complete: () => {
topAppBarContextProvider.setValue({
headlineKey: 'page_order_list_headline',
startIcon: buttons.backToHome,
endIconList: [buttons.newOrder, {...buttons.reloadOrderStorage, disabled: this.gotState === 'reloading'}],
});
const orderStorage = orderStorageContextConsumer.getResponse();
if (orderStorage == null) return;
const orderListTemplate = guard(orderStorage.meta.lastUpdated, () =>
mapObject(this, orderStorage.data, (order) => {
return html`<alwatr-order-status-box
.content=${order}
.clickSignalId=${buttons.showOrderDetail.clickSignalId}
></alwatr-order-status-box>`;
}),
);
return [html`<div class="reloadingFailed">reloading failed</div>`, orderListTemplate];
return [html`<div class="reloadingFailed">reloading failed</div>`, this.orderListTemplate()];
},
});
}

private orderListTemplate(): unknown {
const orderStorage = orderStorageContextConsumer.getResponse();
if (orderStorage == null) return;
return guard(orderStorage.data, () =>
mapObject(this, orderStorage.data, (order) => {
console.warn(1);
return html`<alwatr-order-status-box
.content=${order}
.clickSignalId=${buttons.showOrderDetail.clickSignalId}
></alwatr-order-status-box>`;
}),
);
}
}

0 comments on commit 06a94f1

Please sign in to comment.