Project

General

Profile

Edit Copy Actions

Feature #7641

open

implement the auto data update on product and sale analysis screen for all the tabs and pos split section UI modification

Added by Teja Sriram Sangani about 1 month ago. Updated about 1 month ago.

Status:
In Progress
Priority:
Normal
Target version:
-
Start date:
02/11/2026
Due date:
% Done:

80%

Estimated time:
12:00 h
Spent time:

Add

Subtasks


Add

Related issues

Updated by Teja Sriram Sangani about 1 month ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 80

1. Sale screen – auto-fill without refresh
Checked that when a sale is created on POS or from a product quotation, the sale screen details are filled without a full page refresh.
You wanted the same behavior on the dashboard and sales data.
2. Dashboard – auto update (cards & sales data)
Event: When a sale or product quotation is created from POS, the dashboard refetches data.
Same tab: window custom event pos-sale-or-quote-created.
Other tabs: localStorage key pos-sale-or-quote-created + storage event.
Dispatch: In POSBillingScreen.tsx → onPaymentSuccess dispatches the event and writes the localStorage key.
Listeners: In Home.tsx (Dashboard) we listen for both and call the dashboard fetch (e.g. /nus-sale/analysis).
3. Dashboard – no skeleton on “data updated” refetch
Requirement: Skeleton only on first load/refresh/navigate; when data is updated after a new sale, only the values should update (no skeleton).
Change: fetchData(showLoading = true) in Home.tsx. Initial load uses fetchData() (skeleton). Event-driven refetch uses fetchData(false) (silent update).
4. POS Orders screen – auto update
POSOrders.tsx: Listens for pos-sale-or-quote-created and storage and calls fetchOrderTrackings() so the POS Orders list updates when a sale/quote is created (same or other tab).
6. Sales.tsx – auto update + silent refetch
Auto update: Listens for pos-sale-or-quote-created and storage and calls refetch() so the Sales list updates when a sale/quote is created.
Silent refetch: silentRefetchRef; fetchActiveSales / fetchDeletedSales only call setIsLoading(true) when !silentRefetchRef.current. Socket sale:new and the new event handlers set the ref and then refetch so the table/cards update without skeleton.
7. Product Analysis & Sales – Products section
productanalysis.tsx: Same pattern as Sales: silentRefetchRef + fetchProductsRef, fetchProducts only sets loading when !silentRefetchRef.current, and listeners for pos-sale-or-quote-created and storage that set the ref and call fetchProductsRef.current() so the products list and summary cards update without skeleton.
8. Product Quotations section
Quotes.tsx: Same behavior for the Product Quotations tab: silentRefetchRef, showLoading = (isLoading || isFetching) && !silentRefetchRef.current, and listeners for pos-sale-or-quote-created and storage that set the ref, call refetchQuotes(), then clear the ref in .then(). Summary cards, table, and pagination use showLoading so skeleton only shows on initial load/filter change, not on event-driven refetch.

Edit Copy Actions

Also available in: Atom PDF