Skip to content

fix(ts2304): re-adiciona hook de voz no AdvancedSearch + expõe createCollection (-8 erros baseline)#216

Merged
adm01-debug merged 1 commit into
mainfrom
claude/fix-ts2304-advancedsearch-collections
May 24, 2026
Merged

fix(ts2304): re-adiciona hook de voz no AdvancedSearch + expõe createCollection (-8 erros baseline)#216
adm01-debug merged 1 commit into
mainfrom
claude/fix-ts2304-advancedsearch-collections

Conversation

@adm01-debug
Copy link
Copy Markdown
Owner

@adm01-debug adm01-debug commented May 24, 2026

Resumo

Reduz o baseline de TypeScript em 8 erros (1089 → 1081), eliminando 8× TS2304 (Cannot find name) em dois pontos acoplados. Tudo validado no mesmo ambiente, sem casts cegos, comportamento preservado.

Mudanças

1. AdvancedSearch.tsx — re-adiciona o hook de voz (−6)

  • Importa useSpeechRecognition de @/hooks/intelligence.
  • Destrutura { isListening, transcript, isSupported: isVoiceSupported }.
  • Elimina os 6× TS2304: isListening (l.186/187/197/201), transcript (l.187), isVoiceSupported (l.223).
  • Comportamento preservado: o botão de microfone (gated por isVoiceSupported) continua abrindo o VoiceSearchOverlayConnected, que tem o agente real (useVoiceAgent). Os estados inline (isListening/transcript) só refletem o input no campo de busca.
  • Os 3 símbolos são todos usados → sem unused-var novo.

2. useCollectionsPageState.ts + CollectionsPage.tsx — expõe createCollection (−2)

  • O hook já consumia createCollection internamente (de useCollectionsContext) mas não o expunha no return. A página chamava createCollection(name, description, color, icon) nos handlers onDuplicate das coleções externas (l.300/313) → 2× TS2304.
  • Fix: adiciona createCollection ao return do hook e ao destructure da página. As chamadas já passam os 4 args corretos (createCollection já é chamado com 4 args internamente em handleClone, l.126 — clientId/clientName são opcionais).
  • Por que não usar handleCreate: handleCreate não recebe argumentos (() => createCollection(formData.…), usa o estado do formulário). Trocar os onDuplicate por handleCreate() quebraria a duplicação (criaria coleção a partir do form, não da coleção duplicada). Por isso o swap foi descartado.

Por que os dois fixes estão no mesmo PR

Reduzir os 6 erros do AdvancedSearch faz o tsc passar a emitir a sugestão de spelling na l.300 do CollectionsPage, trocando o rótulo do mesmo erro pré-existente de createCollection: TS2304TS2552 (Did you mean 'updateCollection'?). Confirmado determinístico (2 runs cada): main limpa = TS2304 estável (casa com baseline {TS2304: 2}); branch editado = TS2552. Como o gate compara por (arquivo, código), o TS2552 apareceria como código novo (1 > 0) e dispararia uma regressão fantasma. Resolver createCollection no mesmo PR zera os dois erros e elimina o flip.

Validação (binário direto node_modules/.bin/tsc)

  • TSC: 1089 → 1081 (−8). AdvancedSearch: só resta o TS2345 pré-existente (l.223, SearchResult[] vs Record<string, unknown>[] — outra categoria, não tocado). CollectionsPage: zero erros.
  • Regressão normalizada (ignora linha/coluna): vazia → nenhum erro novo, nenhum flip novo em outro arquivo.
  • vite build: exit 0.
  • ESLint (3 arquivos): CollectionsPage e o hook limpos. AdvancedSearch mostra toast unused + exhaustive-depsambos pré-existentes (já na main limpa e no .eslint-baseline.json: {no-unused-vars: 1, exhaustive-deps: 1}). Sem issue novo.
  • .tsc-baseline.json intocado (blob bf34cb11).

Arquivos (3)

  • src/components/search/AdvancedSearch.tsx
  • src/pages/collections/useCollectionsPageState.ts
  • src/pages/collections/CollectionsPage.tsx

Summary by cubic

Fixes two TS2304 sources by restoring the voice hook in AdvancedSearch and exposing createCollection in Collections, reducing the TypeScript baseline by 8 errors with no behavior changes.

  • Bug Fixes
    • AdvancedSearch: import useSpeechRecognition from @/hooks/intelligence and use isListening, transcript, and isSupported to remove 6 TS2304s.
    • Collections: return createCollection from useCollectionsPageState and destructure it in the page to remove 2 TS2304s from onDuplicate. Kept handleCreate unchanged since it uses form state and would break duplication.
    • Prevented a TS error label flip (TS2304 → TS2552) by fixing both spots together, avoiding CI noise.
    • Validation: tsc 1089 → 1081, vite build OK, ESLint unchanged from baseline.

Written for commit b6cab1d. Summary will update on new commits. Review in cubic

Summary by CodeRabbit

Release Notes

  • New Features

    • Busca por voz: O campo de pesquisa avançado agora suporta reconhecimento de voz, permitindo realizar buscas usando comandos auditivos quando disponível no navegador.
  • Bug Fixes

    • Corrigido problema na duplicação de coleções que impedia a criação adequada de novas coleções durante operações de duplicação.

Review Change Stack

…Collection (-8 erros baseline)

- AdvancedSearch.tsx: importa useSpeechRecognition de @/hooks/intelligence e
  destrutura { isListening, transcript, isSupported: isVoiceSupported }.
  Elimina 6x TS2304 (isListening, transcript, isVoiceSupported). Comportamento
  preservado: o botao de microfone continua abrindo o overlay (que tem o agente
  real via useVoiceAgent); os estados inline refletem o input.

- useCollectionsPageState.ts + CollectionsPage.tsx: expoe createCollection no
  return do hook e destrutura na pagina. Elimina 2x TS2304 (createCollection nas
  l.300/313, handlers onDuplicate das colecoes externas). handleCreate NAO serve
  (nao recebe args, usa formData) -> trocar quebraria a duplicacao. Acoplado no
  mesmo PR porque reduzir os erros do AdvancedSearch fazia o tsc trocar o rotulo
  do erro pre-existente de createCollection na l.300 (TS2304 -> TS2552 "did you
  mean updateCollection"), o que dispararia o gate por (arquivo,codigo).

Validacao (binario direto node_modules/.bin/tsc): 1089 -> 1081 (-8); regressao
normalizada vazia; vite build exit 0; eslint = baseline (toast unused +
exhaustive-deps ja pre-existentes no AdvancedSearch); .tsc-baseline.json intocado.
Copilot AI review requested due to automatic review settings May 24, 2026 02:04
@vercel
Copy link
Copy Markdown

vercel Bot commented May 24, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
we-dream-big Ready Ready Preview, Comment May 24, 2026 2:05am

@supabase
Copy link
Copy Markdown

supabase Bot commented May 24, 2026

This pull request has been ignored for the connected project doufsxqlfjyuvxuezpln because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 24, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 5035996d-f279-40fc-a451-3fd1cea0f1ac

📥 Commits

Reviewing files that changed from the base of the PR and between 5373bde and b6cab1d.

📒 Files selected for processing (3)
  • src/components/search/AdvancedSearch.tsx
  • src/pages/collections/CollectionsPage.tsx
  • src/pages/collections/useCollectionsPageState.ts

Walkthrough

Este PR adiciona dois aprimoramentos compactos: busca por voz em AdvancedSearch via hook useSpeechRecognition, e exposição da função createCollection através de useCollectionsPageState para que CollectionsPage acesse-a nos handlers de duplicação.

Changes

Voice Search Integration and Collection Management Export

Layer / File(s) Summary
Voice search integration in AdvancedSearch
src/components/search/AdvancedSearch.tsx
Hook useSpeechRecognition é importado e inicializado, fornecendo isListening, transcript e isVoiceSupported. O campo de busca exibe "Ouvindo..." quando ativo e preenche o valor com o transcript; botão de microfone é renderizado condicionalmente à disponibilidade de suporte a voz.
createCollection export and consumption
src/pages/collections/useCollectionsPageState.ts, src/pages/collections/CollectionsPage.tsx
Hook useCollectionsPageState passa a expor createCollection em seu retorno. Componente CollectionsPage extrai a função do estado para utilizá-la nos handlers de duplicação de coleções externas.

Estimated Code Review Effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed O título descreve precisamente as duas mudanças principais (re-adiciona hook de voz + expõe createCollection) e quantifica o impacto (-8 erros TS2304), alinhando com o que a mudança entrega.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/fix-ts2304-advancedsearch-collections

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Reduces the TypeScript error baseline by reintroducing missing voice-search state in AdvancedSearch and by exposing createCollection from the collections page state hook so the page can duplicate external collections without TS2304/TS2552 symbol errors.

Changes:

  • AdvancedSearch: import and use useSpeechRecognition to provide isListening, transcript, and isVoiceSupported.
  • useCollectionsPageState + CollectionsPage: return and destructure createCollection so external collection duplication handlers compile.
  • Avoids TS error-code “flip” noise by fixing both coupled sites in the same PR.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/components/search/AdvancedSearch.tsx Restores voice-related hook usage to remove missing-symbol TS errors and gate mic UI by support.
src/pages/collections/useCollectionsPageState.ts Exposes createCollection in the hook return so callers can use it.
src/pages/collections/CollectionsPage.tsx Uses createCollection from page state for external collection duplication handlers.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +54 to +55
// Voice support detection + live listening state (overlay drives the actual agent)
const { isListening, transcript, isSupported: isVoiceSupported } = useSpeechRecognition();
@adm01-debug adm01-debug merged commit 4ab3ae9 into main May 24, 2026
28 of 31 checks passed
@adm01-debug adm01-debug deleted the claude/fix-ts2304-advancedsearch-collections branch May 24, 2026 02:10
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.

2 participants