Skip to content

fix: add await to BrowserCache.get calls in total hooks#87

Merged
IvanildoBarauna merged 1 commit intomainfrom
fix/total-hooks-cache
Mar 4, 2026
Merged

fix: add await to BrowserCache.get calls in total hooks#87
IvanildoBarauna merged 1 commit intomainfrom
fix/total-hooks-cache

Conversation

@IvanildoBarauna
Copy link
Member

Summary

  • Corrige erro de TypeScript no build Docker que impedia o deploy em produção
  • Adiciona await nas chamadas a BrowserCache.get() nos hooks useTotalEducation, useTotalExperience e useTotalProjects
  • O método BrowserCache.get é assíncrono (IndexedDB) desde a migração localStorage→IndexedDB (PR Migrate cache service from localStorage to IndexedDB #84), mas os hooks foram adicionados sem o await, fazendo Promise<T | null> ser passada diretamente ao setState

Root cause

Type error: Argument of type 'Promise<string | null>' is not assignable
to parameter of type 'SetStateAction<string>'.

O commit e1e08dd migrou cacheService.ts para IndexedDB tornando BrowserCache.get() assíncrono. Os hooks desta branch foram criados com base na API síncrona (localStorage) e não incluíam await.

Test plan

  • npm run build executado localmente sem erros de TypeScript
  • Build completo com sucesso (Next.js 16.1.6)

🤖 Generated with Claude Code

BrowserCache.get is async (IndexedDB) since the localStorage→IndexedDB
migration. The total hooks were calling it without await, causing a
Promise<T | null> to be passed directly to setState instead of the
resolved value.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@IvanildoBarauna IvanildoBarauna merged commit e4e06b7 into main Mar 4, 2026
5 checks passed
@IvanildoBarauna IvanildoBarauna deleted the fix/total-hooks-cache branch March 4, 2026 00:50
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.

1 participant