Skip to content

Refactored SSE watcher to manage multiple event sources#534

Merged
stijnpotters1 merged 2 commits into
masterfrom
fix/refine-watcher
Jun 2, 2026
Merged

Refactored SSE watcher to manage multiple event sources#534
stijnpotters1 merged 2 commits into
masterfrom
fix/refine-watcher

Conversation

@stijnpotters1
Copy link
Copy Markdown
Contributor

Before every component was calling useSseWatcher with the same URL would open its own EventSource connection. When the component unmounted, it would close it immediately and this continued.

Now if two components watch the same URL, they reuse the same EventSource. Each registers its own handler on that shared connection. The connection only closes when the last subscriber unmounts

@stijnpotters1 stijnpotters1 requested a review from Matthbo June 2, 2026 12:08
@stijnpotters1 stijnpotters1 self-assigned this Jun 2, 2026
@stijnpotters1 stijnpotters1 linked an issue Jun 2, 2026 that may be closed by this pull request
Copy link
Copy Markdown
Member

@Matthbo Matthbo left a comment

Choose a reason for hiding this comment

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

Wow that's easy
The only thing that could be improved is to keep the watcher open as long as the project is open. Now it seems to close on the configuration overview page and reopen once navigated back to either the editor or studio page.
Is this possible?

@stijnpotters1 stijnpotters1 requested a review from Matthbo June 2, 2026 13:29
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Jun 2, 2026

Copy link
Copy Markdown
Member

@Matthbo Matthbo left a comment

Choose a reason for hiding this comment

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

Great 😄

@stijnpotters1 stijnpotters1 merged commit 7bdbd15 into master Jun 2, 2026
5 checks passed
@stijnpotters1 stijnpotters1 deleted the fix/refine-watcher branch June 2, 2026 14:14
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.

Improve watch efficiency in frontend

2 participants