Implemented: Added basic support for storing transfer order detail data in IndexedDB using Dexie.js#545
Conversation
…ta in IndexedDB using Dexie.js
|
I need some more context to better understand the the workflow. Tell me if I am wrong
Functions: |
|
Thank you for providing feedback! Let me clarify the workflow. This implementation enhances the TransferOrderDetails page in our PWA, where users select a transfer order (TO) from the list to view details and perform some actions. Dexie.js caches TO data in IndexedDB to enable offline access and reduce API calls on page reloads. When the page loads (ionViewWillEnter), the fetchTransferOrderDetail action checks the cache first and falls back to the server if needed, storing the API response for future use. You’re correct about the UI workflow: users find a TO, select it to view details, and interact with it. Your description of the functions is mostly accurate:
Clarifications:
|
Related Issues
Short Description and Why It's Useful
Integrated Dexie.js to cache transfer order data in IndexedDB and reducing API calls for repeated page loads. Data is stored with
orderIdas the key and API response as the value.Added a new file in the util (dexie.ts)
Orderinterface:{ orderId: string; data: any; lastUpdatedStamp: number; }for type safety.orderstable withEntityTable<Order, 'orderId'>.db.version(1).stores({ orders: 'orderId, lastUpdatedStamp' });(primary key:orderId; indexed:lastUpdatedStampfor potential cache expiration).getOrder(orderId: string): Retrieves order from Dexie.saveOrder(orderId: string, data: any): Saves/updates order in Dexie.Changes in Vuex Action (fetchTransferOrderDetail)
getOrder(orderId)first; if cached, usecachedOrder.dataand skip API.saveOrder(orderId, order).Contribution and Currently Important Rules Acceptance