Skip to content

perf(router): expose preloadStaleTime + add pdp-fast-navigation skill - #7

Merged
JonasJesus42 merged 4 commits into
mainfrom
chore/pdp-fast-navigation
May 13, 2026
Merged

perf(router): expose preloadStaleTime + add pdp-fast-navigation skill#7
JonasJesus42 merged 4 commits into
mainfrom
chore/pdp-fast-navigation

Conversation

@JonasJesus42

@JonasJesus42 JonasJesus42 commented May 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

Configuração de prefetch + remoção da skill local (movida para o framework).

1. src/router.tsxcreateTanStackRouter direto com defaultPreloadStaleTime

Substitui createDecoRouter (que em @decocms/start@5.1.1 não expõe defaultPreloadStaleTime) por createTanStackRouter direto, reusando decoParseSearch/decoStringifySearch.

Configurações:

  • defaultPreloadStaleTime: 60_000 — hover prefetch reusado por 60s
  • defaultPreloadGcTime: 5 * 60_000 — mantém em memória 5min
  • QueryClient.staleTime: 60_000 (antes era 30_000)

Resultado: hover em product card + click dentro de 60s → navegação instantânea (cache hit, sem segundo fetch).

Follow-up: decocms/blocks#174 foi merged e expande createDecoRouter nativamente. Quando publicado no npm, este template volta a usar createDecoRouter (PR follow-up).

2. .cursor/skills/deco-pdp-fast-navigation/ — removido

A skill foi movida para o framework @decocms/start/.cursor/skills/deco-pdp-fast-navigation/SKILL.md em decocms/blocks#174. Storefronts cloned desse template + dependentes de @decocms/start herdam a skill via npm — não precisa duplicar.

Files changed

  • src/router.tsxcreateTanStackRouter direto com preload options
  • .cursor/skills/deco-pdp-fast-navigation/SKILL.mddeletado (movido pro framework)

Test plan

  • Build sobe sem erros (CI)
  • bun run typecheck passa limpo
  • Hover em product card → DevTools Network mostra prefetch em ~50ms
  • Click após hover → navegação instantânea, sem segundo fetch
  • URL filters VTEX continuam funcionando (?filter.brand=Nike&filter.brand=Adidas round-trips correto)
  • Skill ainda discoverable via skill listing tools (vindo de @decocms/start/.cursor/skills/)

Status do release do framework

PR decocms/blocks#174 foi merged mas o release CI falhou no @semantic-release/git push para main por causa da branch protection rule (Changes must be made through a pull request). Conseqüência: npm continua em 5.1.1, sem as novas opções de preload em createDecoRouter.

Opções para destravar:

  1. Configurar branch protection para permitir bot push de tag/commit do semantic-release
  2. Trocar @semantic-release/git por estratégia que não precise push em main (ex: tag-only)
  3. Publish manual com npm publish a partir do main local atualizado

Após release publicado, este PR pode ter follow-up para voltar a createDecoRouter nativo.

🤖 Generated with Claude Code

createDecoRouter only exposes defaultPreload (no defaultPreloadStaleTime,
GcTime, or Delay), so prefetch results may be considered stale by the
time the user clicks — causing a wasted second fetch.

Replace createDecoRouter with createTanStackRouter direct, re-importing
the Deco search parsers (decoParseSearch/decoStringifySearch) so URL
behavior is unchanged. Add:
- defaultPreloadStaleTime: 60_000
- defaultPreloadGcTime: 5 * 60_000
- QueryClient staleTime: 60_000 (was 30_000)

Result: hover prefetch is reused on click within 60s — typical product
card → PDP navigation becomes instant.

Also add .cursor/skills/deco-pdp-fast-navigation/SKILL.md documenting
the full pattern (4 levers + anti-CLS) discovered while optimizing
baggagio-tanstack. Storefronts cloned from this template inherit both
the router config and the skill.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Preview deployed

URL
Version
Alias

The skill is now in @decocms/start/.cursor/skills/deco-pdp-fast-navigation
(see decocms/deco-start PR #174), so it's inherited via npm instead of
duplicated in the template. Removing the local copy avoids drift.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
JonasJesus42 and others added 2 commits May 13, 2026 12:56
….2.1

The bypass (createTanStackRouter direct + decoParseSearch re-imports)
was necessary because createDecoRouter on 5.1.1 did not expose
defaultPreloadStaleTime, GcTime, etc.

@decocms/start@5.2.1 (from decocms/blocks#174) now exposes those
options natively. Drop the bypass and use createDecoRouter — same
behavior, fewer imports, no FRAMEWORK-ISSUE marker needed.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@decocms/start 5.2 moved generator scripts from scripts/*.ts to
bundled dist/scripts/*.cjs (PR #166). Update package.json to invoke
them with node instead of tsx, from the new path.

Without this, bun run build fails with ERR_MODULE_NOT_FOUND on
scripts/generate-blocks.ts because that file no longer exists in
the published package — only the compiled .cjs does.

Includes meta.gen.json + loaders.gen.ts regen from the build that
now actually runs to completion.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@JonasJesus42
JonasJesus42 merged commit 07644d1 into main May 13, 2026
1 of 2 checks passed
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