perf(web): deduplicar fetch de auth/notifications en AppBar (#277) - #349
Merged
Conversation
AppBar hacía sus propias llamadas a /auth/me y /notifications/mine en cada página pública para usuarios autenticados, duplicando las llamadas que otros consumidores (dashboard-layout, páginas de recepción/recursos, etc.) ya hacen en la misma request a través de getMe()/getNotificationUnread() en navigation-data.ts, ambas ya envueltas en React cache(). Se reemplazan las llamadas directas a la API por esos loaders cacheados, reutilizando el mismo round-trip dentro de una request en vez de repetirlo por página.
# Conflicts: # apps/web/src/components/organisms/app-bar.tsx
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #277
Sustituye a #337 (rama de fork con conflicto irresoluble desde fuera del fork): mismo cambio, rebasado sobre
main(que ya incluye #336 y #338).Contexto
AppBarhacía sus propias llamadasapi.GET('/auth/me')+api.GET('/notifications/mine')sin pasar por el cache de datos. Desde #280,getMe()/getNotificationUnread()(ennavigation-data.ts) están envueltas enReact.cache()y varias páginas ya las usan, así que en cualquier página que renderizaAppBary también usa esos loaders,/auth/mese duplicaba dentro del mismo request.Solución
AppBarusagetMe()/getNotificationUnread()en lugar de llamadasapi.GETpropias. Cambio mínimo (1 fichero). Se preserva elPromise.all(paralelismo intacto) y la lógica denextdel login (resolveAppBarCurrentPath, #278/#336).Resolución de conflicto
El conflicto era solo el bloque de imports de
app-bar.tsx: se conserva el import mínimo de@/lib/auth(el dedupe elimina el uso deapi/getToken/authHeaders) y se mantiene el import deresolveAppBarCurrentPath. El cuerpo integra ambos cambios (dedupe +currentPath).Crédito
Cambio original: PR #337.