saleor / saleor-dashboard

A GraphQL-powered, single-page dashboard application for Saleor.
BSD 3-Clause "New" or "Revised" License
844 stars 1.1k forks source link

Can't delete more than 20 products at once #2037

Closed rrrnld closed 2 years ago

rrrnld commented 2 years ago

What I'm trying to achieve

I'd like to delete many products through the dashboard. When trying to delete more than 20, I receive an error.

Steps to reproduce the problem

  1. Go to the product listing page (https://saleor.url/dashboard/products/?asc=true&sort=name)
  2. Scroll down, select "No. of rows" more than 20
  3. Scroll up, click the checkbox left of the "name" column header to select all products on the page
  4. Click on the trash icon in the top right
  5. See the following error appear.

I also just noted that the selection switches when modal appears after clicking the trash icon, which might be related.

Screenshots

image

Http request and response from inspector

Request:

{
  "operationName": "productBulkDelete",
  "query": "mutation productBulkDelete($ids: [ID!]!) {\n  productBulkDelete(ids: $ids) {\n    errors {\n      ...ProductError\n      __typename\n    }\n    __typename\n  }\n}\n\nfragment ProductError on ProductError {\n  code\n  field\n  message\n  __typename\n}\n",
  "variables": {
    "ids": [
      {
        "0": "UHJvZHVjdDoyMDY1",
        "1": "UHJvZHVjdDoyMDY2",
        "2": "UHJvZHVjdDo5NDI=",
        "3": "UHJvZHVjdDoxODE1",
        "4": "UHJvZHVjdDoxODE2",
        "5": "UHJvZHVjdDoxODE3",
        "6": "UHJvZHVjdDoxODE4",
        "7": "UHJvZHVjdDoxMDc0",
        "8": "UHJvZHVjdDoxOTYy",
        "9": "UHJvZHVjdDoxOTYz",
        "10": "UHJvZHVjdDoxOTY0",
        "11": "UHJvZHVjdDoxOTY1",
        "12": "UHJvZHVjdDoxMjk0",
        "13": "UHJvZHVjdDoyMTQz",
        "14": "UHJvZHVjdDoyMTQ0",
        "15": "UHJvZHVjdDoyMTQ1",
        "16": "UHJvZHVjdDoyMTQ2",
        "17": "UHJvZHVjdDo3NTI=",
        "18": "UHJvZHVjdDoxNjY0",
        "19": "UHJvZHVjdDoxNjY1",
        "20": "UHJvZHVjdDoxNjY2",
        "21": "UHJvZHVjdDoxNjY3",
        "22": "UHJvZHVjdDo4ODc=",
        "23": "UHJvZHVjdDoxNzcx",
        "24": "UHJvZHVjdDoxNzcy",
        "25": "UHJvZHVjdDoxNzcz",
        "26": "UHJvZHVjdDoxNzc0",
        "27": "UHJvZHVjdDo4NDc=",
        "28": "UHJvZHVjdDoyMjA5",
        "29": "UHJvZHVjdDoyMjEw",
        "30": "UHJvZHVjdDoyMjEx",
        "31": "UHJvZHVjdDoyMjEy",
        "32": "UHJvZHVjdDoxNzQw",
        "33": "UHJvZHVjdDoxNzQx",
        "34": "UHJvZHVjdDoxNzQy",
        "35": "UHJvZHVjdDoxMDg5",
        "36": "UHJvZHVjdDoxOTc0",
        "37": "UHJvZHVjdDoxOTc1",
        "38": "UHJvZHVjdDoxOTc2",
        "39": "UHJvZHVjdDoxOTc3",
        "40": "UHJvZHVjdDo3MDI=",
        "41": "UHJvZHVjdDoxNjI0",
        "42": "UHJvZHVjdDoxNjI1",
        "43": "UHJvZHVjdDoxNjI2",
        "44": "UHJvZHVjdDoxNjI3",
        "45": "UHJvZHVjdDoxMDA3",
        "46": "UHJvZHVjdDoxOTA1",
        "47": "UHJvZHVjdDoxOTA2",
        "48": "UHJvZHVjdDoxOTA3",
        "49": "UHJvZHVjdDoxOTA4"
      }
    ]
  }
}

Response:

{
  "data": {
    "productBulkDelete": {
      "errors": [
        {
          "code": "GRAPHQL_ERROR",
          "field": "ids",
          "message": "Could not resolve to a node with the global id list of '[\"{'0': 'UHJvZHVjdDoyMDY1', '1': 'UHJvZHVjdDoyMDY2', '2': 'UHJvZHVjdDo5NDI=', '3': 'UHJvZHVjdDoxODE1', '4': 'UHJvZHVjdDoxODE2', '5': 'UHJvZHVjdDoxODE3', '6': 'UHJvZHVjdDoxODE4', '7': 'UHJvZHVjdDoxMDc0', '8': 'UHJvZHVjdDoxOTYy', '9': 'UHJvZHVjdDoxOTYz', '10': 'UHJvZHVjdDoxOTY0', '11': 'UHJvZHVjdDoxOTY1', '12': 'UHJvZHVjdDoxMjk0', '13': 'UHJvZHVjdDoyMTQz', '14': 'UHJvZHVjdDoyMTQ0', '15': 'UHJvZHVjdDoyMTQ1', '16': 'UHJvZHVjdDoyMTQ2', '17': 'UHJvZHVjdDo3NTI=', '18': 'UHJvZHVjdDoxNjY0', '19': 'UHJvZHVjdDoxNjY1', '20': 'UHJvZHVjdDoxNjY2', '21': 'UHJvZHVjdDoxNjY3', '22': 'UHJvZHVjdDo4ODc=', '23': 'UHJvZHVjdDoxNzcx', '24': 'UHJvZHVjdDoxNzcy', '25': 'UHJvZHVjdDoxNzcz', '26': 'UHJvZHVjdDoxNzc0', '27': 'UHJvZHVjdDo4NDc=', '28': 'UHJvZHVjdDoyMjA5', '29': 'UHJvZHVjdDoyMjEw', '30': 'UHJvZHVjdDoyMjEx', '31': 'UHJvZHVjdDoyMjEy', '32': 'UHJvZHVjdDoxNzQw', '33': 'UHJvZHVjdDoxNzQx', '34': 'UHJvZHVjdDoxNzQy', '35': 'UHJvZHVjdDoxMDg5', '36': 'UHJvZHVjdDoxOTc0', '37': 'UHJvZHVjdDoxOTc1', '38': 'UHJvZHVjdDoxOTc2', '39': 'UHJvZHVjdDoxOTc3', '40': 'UHJvZHVjdDo3MDI=', '41': 'UHJvZHVjdDoxNjI0', '42': 'UHJvZHVjdDoxNjI1', '43': 'UHJvZHVjdDoxNjI2', '44': 'UHJvZHVjdDoxNjI3', '45': 'UHJvZHVjdDoxMDA3', '46': 'UHJvZHVjdDoxOTA1', '47': 'UHJvZHVjdDoxOTA2', '48': 'UHJvZHVjdDoxOTA3', '49': 'UHJvZHVjdDoxOTA4'}\"]'.",
          "__typename": "ProductError"
        }
      ],
      "__typename": "ProductBulkDelete"
    }
  },
  "extensions": {
    "cost": {
      "requestedQueryCost": 0,
      "maximumAvailable": 50000
    }
  }
}

System information

Saleor version:

Operating system:

Browser:

timuric commented 2 years ago

@heyarne mutation looks incorrect. It should be a list of ids instead of a dictionary. I guess you either are running an outdated or incompatible version of the dashboard or it is forked.

This is how it should look like:

mutation productBulkDelete($ids: [ID!]!) {
  productBulkDelete(ids: $ids) {
    errors {
      ...ProductError
      __typename
    }
    __typename
  }
}

fragment ProductError on ProductError {
  code
  field
  message
  __typename
}
{
  "ids": [
    "UHJvZHVjdDo3Mg==",
    "UHJvZHVjdDo3NA==",
    "UHJvZHVjdDoxMjI="
  ]
}

You can create a free dev account with Saleor cloud and use it as a reference.