fix: corrigir memory leaks e testes de mocks

- Fechar ConvexClient antigo antes de criar novo (evita memory leak)
- Adicionar flag disposed para prevenir race condition em useEffect
- Reduzir polling SSE de 1s para 5s (balanco entre responsividade e carga)
- Adicionar .take() aos mocks de testes para compatibilidade

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
esdrasrenan 2025-12-09 21:49:04 -03:00
parent 638faeb287
commit 508f915cf9
5 changed files with 39 additions and 6 deletions

View file

@ -60,8 +60,12 @@ describe("convex.machines.getById", () => {
collect: vi.fn(async () => [
{ revoked: false, expiresAt: FIXED_NOW + 60_000, lastUsedAt: FIXED_NOW - 1000, usageCount: 5 },
]),
take: vi.fn(async () => [
{ revoked: false, expiresAt: FIXED_NOW + 60_000, lastUsedAt: FIXED_NOW - 1000, usageCount: 5 },
]),
})),
collect: vi.fn(async () => []),
take: vi.fn(async () => []),
})),
}