Skip to content

Conversation

@rishabh998186
Copy link
Contributor

@rishabh998186 rishabh998186 commented Oct 2, 2025

the problem that when you create a new agent or mcp servers you need to refresh the page to see the changes in ui .

so i implemented an auto-refresh system that automatically updates the UI when data changes.

What's Changed


- Added `usePolling` hook for configurable background data fetching

- Enhanced `AgentsProvider` to support background refresh without loading states

- Created settings panel where users can toggle auto-refresh and adjust intervals

- Added refresh indicator showing current status and last update time

- Implemented localStorage persistence for user preferences

- Added manual refresh button for immediate updates

fixes #975

rishabh998186 added 2 commits October 2, 2025 12:57
rishabh998186 added 2 commits October 2, 2025 15:06
Signed-off-by: rishabh998186 <[email protected]>
Signed-off-by: rishabh998186 <[email protected]>
Copy link
Collaborator

@peterj peterj left a comment

Choose a reason for hiding this comment

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

Instead of implementing our own polling mechanisms, we should look into using an existing library -- e.g. https://swr.vercel.app/docs/getting-started -- I think that one should implement everything we need for automatic reloads/refreshes.

rishabh998186 added 2 commits October 3, 2025 14:13
Signed-off-by: rishabh998186 <[email protected]>
Signed-off-by: rishabh998186 <[email protected]>
@rishabh998186
Copy link
Contributor Author

after your feedback i replaced the custom polling mechanisms with SWR which you suggest.

Added SWR dependency and created fetcher utility.

Deleted all custom polling hooks and manual interval logic.

Refactored AgentsProvider to use SWR for automatic data fetching.

Enhanced SettingsContext to generate SWR refresh config from user settings.

Simplified RefreshIndicator to just a loading spinner.

Cleaned up unused code and documentation.

All user refresh controls (interval, toggle, manual button) are preserved.

@rishabh998186 rishabh998186 requested a review from peterj October 3, 2025 09:08
rishabh998186 and others added 2 commits October 3, 2025 15:50
@rishabh998186 rishabh998186 requested a review from peterj October 4, 2025 06:20
@rishabh998186
Copy link
Contributor Author

@peterj, please review my new changes and let me know if there are any other issues that need to be fixed

Copy link
Collaborator

@peterj peterj left a comment

Choose a reason for hiding this comment

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

there are some CORS issues and I can't make this to work

Signed-off-by: rishabh998186 <[email protected]>
@rishabh998186
Copy link
Contributor Author

rishabh998186 commented Oct 9, 2025

@peterj i tested everything and its all working properly and also the CORS middleware is configured correctly in the Go controller and i tested it with the actual port-forwarding scenario you mentioned and there are no more CORS errors showing up in the console. The auto-refresh feature is working when i create or delete agents via kubectl, they show up or disappear in the UI automatically without needing to manually refresh the page. One small thing I changed that the refresh interval was set to 30 seconds which is to slow, so I changed it into 5 seconds and now the UI feels way more responsive and updates almost immediately when you make changes. Please let me know if you spot any other issues.

@rishabh998186
Copy link
Contributor Author

@peterj

Screencast.from.2025-10-11.13-01-05.webm

auto refreshing after every 5 sec

Copy link
Collaborator

@peterj peterj left a comment

Choose a reason for hiding this comment

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

added some comments that need to be address - specifically the one about re-using the existing fetch functions from the /actions folder (and probabyl removing the CORS).

@rishabh998186 rishabh998186 force-pushed the feature/ui-auto-refresh branch from 3078b90 to 868bc82 Compare October 24, 2025 21:36
Signed-off-by: rishabh998186 <[email protected]>
@rishabh998186 rishabh998186 force-pushed the feature/ui-auto-refresh branch from e54c826 to 5ed4aac Compare October 24, 2025 23:20
@rishabh998186
Copy link
Contributor Author

@peterj

I removed the unwanted changes as you suggested. The code is working correctly now and the agents list is coming in alphabetical order consistently on every refresh. Ready for review

@rishabh998186 rishabh998186 requested a review from peterj October 24, 2025 23:34
@rishabh998186
Copy link
Contributor Author

@peterj
Hey, can you review my PR? I’ve made the changes you suggested. Let me know if any other changes are needed.

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.

automatically update the list of agents and mcp servers

2 participants