Real-time Updates & Low-Stock Alerts
Three real-time/push features keep the inventory subsystem responsive: real-time socket events broadcast every quantity change to all logged-in browser tabs in the org without polling, push notifications fire when an item crosses a critical low-stock threshold, and a daily 9am UTC digest tells admins about everything below reorder point. Mobile also has a 24-hour read-only cache for spotty warehouse WiFi.
Steps
- Real-time: nothing to configure. Open Enterprise > Inventory in two browser tabs (same org). Adjust quantity on item X in tab A — tab B updates within ~500ms without a refresh. Works for items, POs, boxes, and movements.
- Critical drop push: items that have a reorder point set will fire a push to OWNER + ADMIN users when their on-hand quantity crosses the threshold quantityOnHand ≤ reorderPoint × 0.25 (i.e. dipped into the bottom 25% of the safety margin). Dedupe is 10 minutes per item per org so a bulk receive can't fire the same alert twice.
- Daily digest push: every day at 9am UTC, every Enterprise org with items below their reorder point gets a single push: "📦 N items below reorder point — ProductName + N more need restocking." Tapping opens the Reorder tab on mobile.
- User opt-out (back-end ready, UI follow-up): each user can disable alerts via User.notificationPrefs.inventory.alertsEnabled = false (or .digestEnabled). Defaults true for OWNER/ADMIN, opt-in for everyone else.
- Mobile offline cache: when the phone loses network, recent inventory list views and item/bin details fall back to a 24-hour AsyncStorage cache. The screen shows an amber "Offline · cached HH:MM ago" banner so you know you're not looking at live data. Mutations (adjust qty, pack box, receive PO) still fail loudly — no queued writes for now.
Good to know
- Throttle: real-time emits are capped at 10 per second per org. Above that, individual events are coalesced into a single inventory:bulk-update event with the affected itemIds at window end. Clients re-fetch impacted queries on receipt — same end result, much smoother UI.
- The critical-drop check looks at both directions: an adjust DOWN that crosses the threshold fires; an adjust UP back above the threshold does NOT (un-fires nothing). The next drop back into the danger zone re-arms.
- Daily digest runs at 9am UTC for all orgs regardless of local time. Timezone-aware scheduling is a planned follow-up.
- The push notification category is "SYSTEM" (no dedicated INVENTORY enum value yet). Mobile routes the tap via data.type (e.g. data.type === "inventory_critical") not category.
Example: A 4-person warehouse team is on the floor. The PO receiver scans a damaged shipment back out of inventory, adjusting the qty down to 0. Two other people's phones buzz within 3 seconds: "⚠️ Critical stock level — Brass Compression Fitting 1/2" is at 0 (reorder point: 15)." The dispatcher who was about to schedule a service call for tomorrow sees the alert, checks the Reorder tab, and lines up a same-day emergency order with the vendor — all without leaving her current screen.
Troubleshooting
Real-time updates stop after the laptop sleeps
The socket disconnects when the OS suspends networking. It auto-reconnects on wake (10 retries, 2s backoff).
Fix: Reconnection is automatic on wake. If quantities still look stale 10+ seconds after waking, switch tabs to force a TanStack Query refocus refetch, or hard-refresh once.
Push notifications never arrive
Either the device has no push token registered (mobile app not opened recently), or notification permissions are denied at the OS level, or the user's notificationPrefs.inventory.alertsEnabled is set to false.
Fix: Open the mobile app — token registration runs on launch. Check OS notification settings (iOS Settings > CRMown > Notifications → allow; Android Settings > Apps > CRMown > Notifications). If the toggle is off, flip it back on (UI for inventory toggles is a planned follow-up — for now the default is on for OWNER/ADMIN).
Daily digest fires at the wrong time of day
The digest runs at 9am UTC for everyone. Timezone-aware scheduling is on the roadmap.
Fix: For now, plan around the 9am UTC tick. If you're in PST that's 1am local; in IST that's 2:30pm local. The 24h cache + real-time updates cover the in-between hours.
Mobile shows "Offline · cached" but the WiFi indicator says I'm connected
The cache shows when the most recent request failed at the network layer, regardless of WiFi indicator. Captive portals, expired certs, or DNS hiccups can present as "connected but broken."
Fix: Pull to refresh. If the fetch succeeds, the banner clears and
stale resets to false. If it still fails, you're actually offline despite what the OS says.Plans
Enterprise suite required. Push notifications use Expo's push service (free at our volume).
Related
- Inventory & Fulfillment — Overview
- Reorder Report & Manufacturer Emails
- Settings — notification preferences