Repository navigation
Conversation
The products resolver read pagination straight off the response body. The view controller redirects when the list cannot be shown - to the 404 controller once it has been deleted, to the home page once it is no longer readable by this visitor - and fetch follows both, so what comes back is a 404 payload or a home page. Reading datas.pagination.total_items off either throws, which is the console error, and the page carries on describing a list that is gone. A redirected response now sends the browser to the request again so the shop renders whichever page it meant to; any other unexpected response returns an empty result instead of throwing.
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.
productsresolver in_dev/front/js/graphql/resolvers.jsreadsdatas.pagination.total_itemsstraight off the response body with no check on the response.BlockWishlistViewModuleFrontControllerredirects whenever the list cannot be shown — to the 404 controller once it has been deleted, to the home page once it is no longer readable by this visitor — andfetchfollows both, so the body is a 404 payload or a home page rather than the product payload. Readingpaginationoff either throws, which is the console error in the report, and the page carries on describing a list that no longer exists. A redirected response now sends the browser to the request again so the shop renders whichever page it meant to; any other unexpected response returns an empty result instead of throwing.sort by. Before the change the console throws onpaginationand the page keeps showing the deleted list; after it, the browser lands on the shop's 404. Same with a shared list whose sharing is revoked, which lands on the home page with the module's own notification.Measured, module 4.0.0 on PrestaShop 9.2
Two different redirects, which is why one guard is not enough.
fetchfollows both, soresponse.statusbelow is the status of the redirect target:
The second case is the one that makes a
!response.oktest insufficient: it ends on a 200, so onlyresponse.redirecteddistinguishes it from a normal answer. Both cases are covered by the singleresponse.redirectedbranch; the!response.okand JSON-parse guards below it exist so that a server errordoes not throw either, without navigating away — a reload on any failure would loop against a persistent 500.
The valid payload always carries
pagination(current_page,items_shown_from,items_shown_to,pages,pages_count,should_be_displayed,total_items), so!datas.paginationis a sound"this is not our payload" test.
The bundle is deliberately not in this branch
public/*.bundle.jsis tracked, and the module loadspublic/productslist.bundle.jsat runtime, so thischange does nothing until the bundle is rebuilt. It is not rebuilt here because the committed bundles do
not reproduce from the committed sources:
npm ci && npm run buildondevproduces a 14-file, 640-linediff before any source change, byte-identical on Node 20 (the version
.github/workflows/build-release.ymluses) and on Node 24, so it is source drift rather than toolchainnoise. Part of it is the license banner the build does not emit — restoring that by hand fixed only 4 of the
14 files. Committing a rebuild here would bury a small fix inside somebody else's unbuilt change, so the
branch carries the source only.
Fixture note
The first measurement of this was wrong.
ps_modulehadactive = 0and nops_module_shoprow, andin that state every request to the module's front controller returns a bare
404 application/json— whichlooked like the real answer and hid the two distinct redirects. Enabling the module for the shop
(
INSERT INTO ps_module_shop) is what exposed them. A module front controller measurement is only validonce the module is associated with the shop.