{"data":{"id":"magento2-37717","source":"github-pr","sourceRef":"magento/magento2#37717","title":"Product Media Gallery GQL response is not sorted by image position","pr":{"number":37717,"url":"https://github.com/magento/magento2/pull/37717","author":"Kannakiraj123","mergedAt":"2024-07-25T14:41:46Z","mergeCommit":"5c130dbf5bf56da264f5f2a157f8b34a2999cb16","headCommit":"921460ad649b21b4d542ee7320cc21b286f82ebb","baseRef":"2.4-develop","diffSha256":"654668f7209701d1177728c874c0ee2f4814c3d20a421e0f97a2bdd2cdf81fef"},"issues":[{"number":37671,"url":"https://github.com/magento/magento2/issues/37671","title":"Product Media Gallery GQL response is not sorted by image position","labels":["Area: Product","Component: Image","Issue: Confirmed","Priority: P2","Progress: done","Reported on 2.4.x","Reproduced on 2.4.x"],"kind":"human"}],"fixedIn":"2.4.8","containingTags":["2.4.8","2.4.8-p1","2.4.8-p2","2.4.8-p3","2.4.8-p4","2.4.8-p5","2.4.9"],"reportedOn":null,"codeMatch":{"2.4.6":"clean","2.4.6-p1":"clean","2.4.6-p2":"clean","2.4.6-p3":"clean","2.4.6-p4":"clean","2.4.6-p5":"clean","2.4.6-p6":"clean","2.4.6-p7":"clean","2.4.6-p8":"clean","2.4.6-p9":"clean","2.4.6-p10":"clean","2.4.6-p11":"clean","2.4.6-p12":"clean","2.4.6-p13":"clean","2.4.6-p14":"clean","2.4.6-p15":"clean","2.4.7":"clean","2.4.7-p1":"clean","2.4.7-p2":"clean","2.4.7-p3":"clean","2.4.7-p4":"clean","2.4.7-p5":"clean","2.4.7-p6":"clean","2.4.7-p7":"clean","2.4.7-p8":"clean","2.4.7-p9":"clean","2.4.7-p10":"clean","2.4.8":"conflict","2.4.8-p1":"conflict","2.4.8-p2":"conflict","2.4.8-p3":"conflict","2.4.8-p4":"conflict","2.4.8-p5":"conflict","2.4.9":"conflict"},"affectedVersions":["2.4.6","2.4.6-p1","2.4.6-p2","2.4.6-p3","2.4.6-p4","2.4.6-p5","2.4.6-p6","2.4.6-p7","2.4.6-p8","2.4.6-p9","2.4.6-p10","2.4.6-p11","2.4.6-p12","2.4.6-p13","2.4.6-p14","2.4.6-p15","2.4.7","2.4.7-p1","2.4.7-p2","2.4.7-p3","2.4.7-p4","2.4.7-p5","2.4.7-p6","2.4.7-p7","2.4.7-p8","2.4.7-p9","2.4.7-p10"],"components":["magento/module-catalog"],"files":[{"path":"app/code/Magento/Catalog/Model/Product/Gallery/ReadHandler.php","change":"modified","package":"magento/module-catalog"}],"stripped":{"tests":[],"docs":[],"outsideCode":[]},"linesChanged":3,"mergeBatched":false,"excluded":null,"sections":{"description":"Gallery images are sorted by their IDs.","stepsToReproduce":"1. Edit the prdouct\n2. Add images\n3. Save it\n4. edit the same product and this time drag the last image to the very first\n5. save the productproduct","expectedResult":"GraphQl response should return the gallery sorted by their position.","actualResult":"Gallery images are sorted by their IDs.","source":"issue"},"signatures":[],"labels":{"area":["Product"],"component":["Image"],"priority":"P2","severity":null,"reportedOn":["2.4.x"]},"categories":["Catalog/Product"],"triage":{"model":"@cf/cloudflare/clef","requestHash":"1bd46f41ed51034f74961694e457993362329f930dcadf8ef93a04552b81c420","isBugfix":0.9769,"changeKind":{"choice":"bugfix","probabilities":{"bugfix":0.9692,"feature":0.0052,"refactor":0.0141,"tests_only":0.0053,"docs_only":0.003,"dependency":0.0032},"confidence":0.9276},"scope":{"score":0.3191,"probabilities":{"0":0.7334,"1":0.2141,"2":0.0525},"confidence":0.3797},"risk":{"score":0.2702,"probabilities":{"0":0.7637,"1":0.2024,"2":0.0339},"confidence":0.438},"area":{"choice":"graphql_api","probabilities":{"catalog":0.3632,"checkout":0.0044,"customer":0.003,"admin":0.0147,"graphql_api":0.5805,"framework":0.0091,"frontend":0.0151,"other":0.01},"confidence":0.3938},"securityRelevant":0.0056,"reportedVersion":{"choice":"unspecified","probabilities":{"2.4.0":0.0096,"2.4.0-p1":0.0048,"2.4.1":0.0031,"2.4.1-p1":0.003,"2.4.2":0.0039,"2.4.2-p1":0.0035,"2.4.2-p2":0.0052,"2.4.3":0.0082,"2.4.3-p1":0.0062,"2.4.3-p2":0.0076,"2.4.3-p3":0.0049,"2.4.4":0.0085,"2.4.4-p1":0.0058,"2.4.4-p10":0.0046,"2.4.4-p11":0.0065,"2.4.4-p12":0.0056,"2.4.4-p13":0.0054,"2.4.4-p14":0.0064,"2.4.4-p15":0.0046,"2.4.4-p16":0.0056,"2.4.4-p17":0.0041,"2.4.4-p18":0.0045,"2.4.4-p2":0.003,"2.4.4-p3":0.0035,"2.4.4-p4":0.0034,"2.4.4-p5":0.0041,"2.4.4-p6":0.0038,"2.4.4-p7":0.0046,"2.4.4-p8":0.004,"2.4.4-p9":0.0036,"2.4.5":0.008,"2.4.5-p1":0.0065,"2.4.5-p10":0.0049,"2.4.5-p11":0.0066,"2.4.5-p12":0.0069,"2.4.5-p13":0.0065,"2.4.5-p14":0.0069,"2.4.5-p15":0.005,"2.4.5-p16":0.0062,"2.4.5-p17":0.0051,"2.4.5-p2":0.0035,"2.4.5-p3":0.0042,"2.4.5-p4":0.005,"2.4.5-p5":0.0048,"2.4.5-p6":0.0057,"2.4.5-p7":0.0061,"2.4.5-p8":0.0043,"2.4.5-p9":0.0035,"2.4.6":0.0073,"2.4.6-p1":0.0082,"2.4.6-p10":0.0057,"2.4.6-p11":0.0083,"2.4.6-p12":0.0072,"2.4.6-p13":0.0072,"2.4.6-p14":0.007,"2.4.6-p15":0.0059,"2.4.6-p2":0.0045,"2.4.6-p3":0.0057,"2.4.6-p4":0.0072,"2.4.6-p5":0.0064,"2.4.6-p6":0.0062,"2.4.6-p7":0.007,"2.4.6-p8":0.0052,"2.4.6-p9":0.0039,"2.4.7":0.0074,"2.4.7-p1":0.0067,"2.4.7-p10":0.0056,"2.4.7-p2":0.0055,"2.4.7-p3":0.0074,"2.4.7-p4":0.0107,"2.4.7-p5":0.0083,"2.4.7-p6":0.0105,"2.4.7-p7":0.0076,"2.4.7-p8":0.0067,"2.4.7-p9":0.0049,"2.4.8":0.0063,"2.4.8-p1":0.007,"2.4.8-p2":0.0089,"2.4.8-p3":0.0085,"2.4.8-p4":0.0096,"2.4.8-p5":0.0073,"2.4.9":0.0095,"unspecified":0.5074},"confidence":0.2517},"backportWorthy":{"score":1.4927,"probabilities":{"0":0.1253,"1":0.2567,"2":0.618},"confidence":0.1953}},"curated":{"title":"Product media gallery GraphQL response is not sorted by image position","description":"When you drag the last image to the very first position and save the product, the GraphQl response for media_gallery has gallery images sorted by their IDs. In the Gallery ReadHandler, sortMediaEntriesByPosition now runs inside addMediaDataToProduct, not in execute, so the gallery is sorted by position for any use of that function. The diff has no usort in the resolver as the PR body says.","categories":["Catalog/Product"],"author":"claude-code/opus-5.5","date":"2026-10-06","reviewedBy":null},"tests":null},"_documentation":"https://magento.watch/api","_description":"Upstream fix magento2-37717 details"}