Skip to content

fix(vtex): stop echoing a page the key already resolved - #13

Merged
marcoferreiradev merged 1 commit into
main-altfrom
fix/pdp-cache-key-props
Sep 2, 2026
Merged

marcoferreiradev merged 1 commit into
main-altfrom
fix/pdp-cache-key-props

Conversation

@marcoferreiradev

Copy link
Copy Markdown
Collaborator

Follow-up to #11, found while validating the storefront's new client-side PLP against it.

pageOf resolves the page into the cache key. The loop that echoes allowed URL params then appended the raw ?page on top, and the two no longer agree — a resolved 0 against a raw 1 — so the dedup that used to collapse them cannot. One page becomes two entries: the storefront renders page 1 with no ?page at all, while its own client-side pagination asks for that same page as ?page=1.

page leaves the echo list; nothing else reads it from there.

Measured

call before after
render, no ?page (warms) miss miss 1738ms
client-side, ?page=1 miss — own entry hit 8ms
?page=2 miss miss 1997ms — still its own
back to no ?page hit hit 5ms

`pageOf` put the resolved page in the key, and the loop below went on appending
the raw `?page` on top of it. The two no longer agree — resolved 0 against a raw
1 — so the dedup that used to collapse them cannot, and one page becomes two
entries: the storefront renders page 1 with no `?page` at all while its own
client-side pagination asks for that same page as `?page=1`.

Measured: the render warms it (miss 1738ms) and the client-side call now reads
it (hit 8ms); page 2 still mints its own (miss 1997ms) and both keep hitting.
Before, each side had its own entry for identical products.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YFJdpNZtWBobnhj3CPPuMj
@marcoferreiradev
marcoferreiradev merged commit cb1389c into main-alt Sep 2, 2026
4 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