zerobyte/app
Nico d5da6d4562
fix: sse connection (#623)
### TL;DR

Refactored `useServerEvents` hook to use a shared EventSource connection across all components instead of creating individual connections per hook instance.

### What changed?

- Introduced shared state management for EventSource connections with reference counting
- Added comprehensive test coverage with MockEventSource implementation
- Modified the hook to share a single EventSource connection across multiple consumers
- Implemented proper cleanup when the last subscriber unmounts
- Removed automatic query refetching on backup completion, keeping only cache invalidation

### How to test?

Run the new test suite with `bun test use-server-events.test.tsx` to verify:
- Single EventSource instance is shared across multiple hook consumers
- Event listeners work correctly with the shared connection
- Cache invalidation occurs once per event
- Proper cleanup happens when all subscribers unmount

### Why make this change?

This optimization reduces resource usage by preventing multiple EventSource connections when the hook is used in different components. The shared connection approach is more efficient while maintaining the same functionality, and the added tests ensure reliability of the server events system.
2026-03-05 22:32:44 +01:00
..
client fix: sse connection (#623) 2026-03-05 22:32:44 +01:00
drizzle fix: run repo stats in background (#620) 2026-03-05 20:18:34 +01:00
lib fix: sso cross org link with valid invite (#621) 2026-03-05 20:21:24 +01:00
middleware feat: OIDC (#564) 2026-03-04 18:48:00 +01:00
routes refactor(sso): extract sso code into it's own module (#617) 2026-03-04 18:48:47 +01:00
schemas chore: gen api-client 2026-02-25 23:19:34 +01:00
server chore: bump drizzle to beta-16 (#622) 2026-03-05 22:23:45 +01:00
test test: increase coverage for existing controllers 2026-03-04 18:48:47 +01:00
utils refactor: render cached data directly if available during ssr 2026-03-04 18:48:47 +01:00
app.css fix: multiple mobile and responsiveness issues (#537) 2026-02-17 18:44:22 +01:00
context.ts feat: OIDC (#564) 2026-03-04 18:48:00 +01:00
router.tsx refactor: render repo stats directly in ssr if cache is available 2026-03-04 18:48:47 +01:00
routeTree.gen.ts feat: separate global admin page (#595) 2026-03-04 18:48:47 +01:00
server.ts fix: apply fk db constraint on app creation 2026-02-16 23:09:18 +01:00