feat: auto-load new namespaces when PromotionStrategies are added#1142
feat: auto-load new namespaces when PromotionStrategies are added#1142
Conversation
Co-authored-by: crenshaw-dev <350466+crenshaw-dev@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1142 +/- ##
==========================================
+ Coverage 50.60% 51.29% +0.69%
==========================================
Files 51 51
Lines 5501 5501
==========================================
+ Hits 2784 2822 +38
+ Misses 2417 2392 -25
+ Partials 300 287 -13 ☔ View full report in Codecov by Sentry. |
|
@copilot if I have 100 PromotionStrategies that are fairly active (updating often), that'll be a lot of list operations on the namespaces. Can we just watch the namespaces instead of listing them? |
… re-listing Co-authored-by: crenshaw-dev <350466+crenshaw-dev@users.noreply.github.com>
Done in ec3c924. Instead of re-calling |
The namespace dropdown fetched namespaces only once on mount, requiring a page refresh to discover namespaces added after initial load.
Changes
NamespaceStore.ts: Added anaddNamespace(ns: string)action that appends a namespace to the list only if it's not already present (no-op otherwise).NamespaceDropdown.tsx: Subscribes to the existing SSE/watch?kind=PromotionStrategyendpoint (no namespace filter = all namespaces). On each event, the namespace is extracted directly from the event payload (metadata.namespace) and added to the store viaaddNamespace— no extra API calls are made. The/list?kind=namespacecall happens only once on mount for the initial list. EventSource is closed on unmount.Reuses the existing SSE infrastructure already in place for PromotionStrategy real-time updates — no backend changes required. New namespaces are discovered purely from the event stream regardless of how many PromotionStrategy events are received.
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.