fix(ts2304): re-adiciona hook de voz no AdvancedSearch + expõe createCollection (-8 erros baseline)#216
Conversation
…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.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
WalkthroughEste PR adiciona dois aprimoramentos compactos: busca por voz em AdvancedSearch via hook ChangesVoice Search Integration and Collection Management Export
Estimated Code Review Effort🎯 1 (Trivial) | ⏱️ ~5 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
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 useuseSpeechRecognitionto provideisListening,transcript, andisVoiceSupported.useCollectionsPageState+CollectionsPage: return and destructurecreateCollectionso 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.
| // Voice support detection + live listening state (overlay drives the actual agent) | ||
| const { isListening, transcript, isSupported: isVoiceSupported } = useSpeechRecognition(); |
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)useSpeechRecognitionde@/hooks/intelligence.{ isListening, transcript, isSupported: isVoiceSupported }.isListening(l.186/187/197/201),transcript(l.187),isVoiceSupported(l.223).isVoiceSupported) continua abrindo oVoiceSearchOverlayConnected, que tem o agente real (useVoiceAgent). Os estados inline (isListening/transcript) só refletem o input no campo de busca.2.
useCollectionsPageState.ts+CollectionsPage.tsx— expõecreateCollection(−2)createCollectioninternamente (deuseCollectionsContext) mas não o expunha noreturn. A página chamavacreateCollection(name, description, color, icon)nos handlersonDuplicatedas coleções externas (l.300/313) → 2× TS2304.createCollectionaoreturndo hook e ao destructure da página. As chamadas já passam os 4 args corretos (createCollection já é chamado com 4 args internamente emhandleClone, l.126 —clientId/clientNamesão opcionais).handleCreate:handleCreatenão recebe argumentos (() => createCollection(formData.…), usa o estado do formulário). Trocar osonDuplicateporhandleCreate()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:TS2304→TS2552 (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), oTS2552apareceria como código novo (1 > 0) e dispararia uma regressão fantasma. ResolvercreateCollectionno mesmo PR zera os dois erros e elimina o flip.Validação (binário direto
node_modules/.bin/tsc)TS2345pré-existente (l.223,SearchResult[]vsRecord<string, unknown>[]— outra categoria, não tocado). CollectionsPage: zero erros.vite build: exit 0.toastunused +exhaustive-deps— ambos pré-existentes (já na main limpa e no.eslint-baseline.json:{no-unused-vars: 1, exhaustive-deps: 1}). Sem issue novo..tsc-baseline.jsonintocado (blobbf34cb11).Arquivos (3)
src/components/search/AdvancedSearch.tsxsrc/pages/collections/useCollectionsPageState.tssrc/pages/collections/CollectionsPage.tsxSummary by cubic
Fixes two TS2304 sources by restoring the voice hook in AdvancedSearch and exposing
createCollectionin Collections, reducing the TypeScript baseline by 8 errors with no behavior changes.useSpeechRecognitionfrom@/hooks/intelligenceand useisListening,transcript, andisSupportedto remove 6 TS2304s.createCollectionfromuseCollectionsPageStateand destructure it in the page to remove 2 TS2304s fromonDuplicate. KepthandleCreateunchanged since it uses form state and would break duplication.tsc1089 → 1081,vite buildOK, ESLint unchanged from baseline.Written for commit b6cab1d. Summary will update on new commits. Review in cubic
Summary by CodeRabbit
Release Notes
New Features
Bug Fixes