Skip to content

[FIX] Enable auto-refresh with polling and manual refresh for admin orders page - #288

Open
Siddh2024 wants to merge 1 commit into
rdodiya:gssoc_developfrom
Siddh2024:fix/285-orders-auto-refresh
Open

[FIX] Enable auto-refresh with polling and manual refresh for admin orders page#288
Siddh2024 wants to merge 1 commit into
rdodiya:gssoc_developfrom
Siddh2024:fix/285-orders-auto-refresh

Conversation

@Siddh2024

Copy link
Copy Markdown
Contributor

Description

Enabled auto-refresh for the admin orders page so new orders appear automatically without manual page refresh.

Changes Made

  • Enabled the previously commented-out 30-second polling interval in useEffect
  • Added lastRefreshed timestamp state that displays when data was last fetched
  • Added "Last updated" indicator showing the time of last refresh
  • Added a "Refresh" button for on-demand manual refresh
  • Added Clock icon import from lucide-react
  • Removed unused useRef import

Testing

  1. Navigate to Admin Orders
  2. Orders load normally with skeleton loading state
  3. A "Last updated" timestamp appears after the first fetch
  4. Click "Refresh" button refreshes with spinner
  5. Wait 30 seconds auto-refresh fires with indicator

Fixes #285

@rdodiya

rdodiya commented Jul 24, 2026

Copy link
Copy Markdown
Owner

Hi @Siddh2024 ,
Please resolve conflicts and check co-pilot review points.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds auto-refresh behavior to the Admin Orders page so newly arriving orders appear without a full page reload, aligning with Issue #285’s request for polling-based updates.

Changes:

  • Enables 30-second polling to periodically refetch orders.
  • Adds a “Last updated” timestamp indicator tied to the most recent fetch time.
  • Adds a manual “Refresh” button with a spinner/refreshing UI state.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 78 to 83
useEffect(() => {
fetchOrders();

// 🔌 UNCOMMENT: Auto-refresh every 30 seconds
// const interval = setInterval(fetchOrders, 30000);
// return () => clearInterval(interval);
const interval = setInterval(fetchOrders, 30000);
return () => clearInterval(interval);
}, []);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ENHANCEMENT] Admin orders page lacks auto-refresh

3 participants