Open cmacma7 opened 5 years ago
If there exist a reservation that not exist at a table, when click the table, code hang. Need to handle reservation not exist case.
TypeError: Cannot read property 'id' of null TableItems._this.showModal C:/bn/tagfans-station/src/components/tables/tableItems.js:68 65 | showModal = (item) => { 66 | console.log(item) 67 | if (item.Seated !== undefined && item.Cleared === false && item.__Seated === true) {
68 | if (item.reservation !== undefined && item.reservation.id !== undefined) { | ^ 69 | const { history } = this.props; 70 | history.push("/order?rid=" + item.__reservation.id) 71 | } View compiled onClick C:/bn/tagfans-station/src/components/tables/tableItems.js:201 198 | } 199 | 200 | return ( 201 | <div className="table-item-wp" key={key} onClick={() => this.showModal(data)}> | ^ 202 | 203 | 204 | View compiled cmacma7 commented 5 years ago problem cause by reservationId is local:9998773, and it does not exist after sync to TBox. We need to handle reservationId change, that means if local id get updated to real id, the components that use localId need to update to real id. cmacma7 commented 5 years ago Sync back to remote how have callback to let App know id changes. orderDB.syncBacktoRemoteDB(function(localToRemote) { console.log("local to remote map"); console.log(localToRemote); }); The callback of syncbackToRemote will have a map of localId to remoteId. need to implement how to let components know the map.
68 | if (item.reservation !== undefined && item.reservation.id !== undefined) { | ^ 69 | const { history } = this.props; 70 | history.push("/order?rid=" + item.__reservation.id) 71 | } View compiled onClick C:/bn/tagfans-station/src/components/tables/tableItems.js:201 198 | } 199 | 200 | return ( 201 | <div className="table-item-wp" key={key} onClick={() => this.showModal(data)}> | ^ 202 |
problem cause by reservationId is local:9998773, and it does not exist after sync to TBox. We need to handle reservationId change, that means if local id get updated to real id, the components that use localId need to update to real id.
Sync back to remote how have callback to let App know id changes.
orderDB.syncBacktoRemoteDB(function(localToRemote) { console.log("local to remote map"); console.log(localToRemote); });
The callback of syncbackToRemote will have a map of localId to remoteId. need to implement how to let components know the map.
If there exist a reservation that not exist at a table, when click the table, code hang. Need to handle reservation not exist case.
TypeError: Cannot read property 'id' of null TableItems._this.showModal C:/bn/tagfans-station/src/components/tables/tableItems.js:68 65 | showModal = (item) => { 66 | console.log(item) 67 | if (item.Seated !== undefined && item.Cleared === false && item.__Seated === true) {