There is no problem not worth solving, and no technology not worth learning!

In GraphQL Mutation, in the same HTTP request, perform multiple Mutation implementations

计划在同一次 HTTP 请求中,执行多个 Mutation。参考:https://graphql.cn/learn/queries/#aliases ,使用别名

1. In GraphQL Mutation, in the same HTTP request, only one mutation is now executed. as shown in Figure 1

在 GraphQL Mutation 中,在同一次 HTTP 请求中,现在仅执行了一个 Mutation
Figure 1

mutation UploadThemeAsset($input: ThemeAssetUploadInput!) {
	onlineStoreThemeAssetUpload(input: $input) {
		themeAsset {
			id
			themeId
			value
			key
			publicUrl
			mimeType
			checksum
			category
			warnings
			createdAt
			updatable
			deletable
			renameable
			updatable
		}
	}
}



{
	"input": {
		"themeId": "{{themeId}}",
		"key": "assets/js/1.js",
		"value": "string"
	}
}



{
  "data": {
    "onlineStoreThemeAssetUpload": {
      "themeAsset": {
        "id": "346186",
        "themeId": "98ad1110-014d-4a61-bbb4-d74bc4ed30f7",
        "value": "string",
        "key": "assets/js/1.js",
        "publicUrl": null,
        "mimeType": "text/plain",
        "checksum": "ecb252044b5ea0f679ee78ec1a12904739e2904d",
        "category": "asset",
        "warnings": [],
        "createdAt": "2023-03-14 17:36:36",
        "updatable": false,
        "deletable": false,
        "renameable": false
      }
    }
  }
}


2. When there are too many HTTP requests per unit time, the current limit of the interface will be triggered. as shown in Figure 2

当单位时间内 HTTP 请求数量过多时,会触发接口的限流
Figure 2

3. It is planned to execute multiple mutations in the same HTTP request. Reference:https://graphql.cn/learn/queries/#aliases, use aliases. as shown in Figure 3

计划在同一次 HTTP 请求中,执行多个 Mutation。参考:https://graphql.cn/learn/queries/#aliases ,使用别名
Figure 3

mutation UploadThemeAsset($input1: ThemeAssetUploadInput!, $input2: ThemeAssetUploadInput!) {
	themeAssetUpload1: onlineStoreThemeAssetUpload(input: $input1) {
		themeAsset {
			...themeAssetFields
		}
	}
  themeAssetUpload2: onlineStoreThemeAssetUpload(input: $input2) {
		themeAsset {
			...themeAssetFields
		}
	}
}

fragment themeAssetFields on ThemeAsset {
  id
  themeId
  value
  key
  publicUrl
  mimeType
  checksum
  category
  warnings
  createdAt
  updatable
  deletable
  renameable
  updatable
}




{
	"input1": {
		"themeId": "{{themeId}}",
		"key": "assets/js/1.js",
		"value": "string"
  },
  "input2": {
		"themeId": "{{themeId}}",
		"key": "assets/js/2.js",
		"value": "string"
	}
}



{
  "data": {
    "themeAssetUpload1": {
      "themeAsset": {
        "id": "346186",
        "themeId": "98ad1110-014d-4a61-bbb4-d74bc4ed30f7",
        "value": "string",
        "key": "assets/js/1.js",
        "publicUrl": null,
        "mimeType": "text/plain",
        "checksum": "ecb252044b5ea0f679ee78ec1a12904739e2904d",
        "category": "asset",
        "warnings": [],
        "createdAt": "2023-03-14 17:36:36",
        "updatable": false,
        "deletable": false,
        "renameable": false
      }
    },
    "themeAssetUpload2": {
      "themeAsset": {
        "id": "346187",
        "themeId": "98ad1110-014d-4a61-bbb4-d74bc4ed30f7",
        "value": "string",
        "key": "assets/js/2.js",
        "publicUrl": null,
        "mimeType": "text/plain",
        "checksum": "ecb252044b5ea0f679ee78ec1a12904739e2904d",
        "category": "asset",
        "warnings": [],
        "createdAt": "2023-03-14 18:04:55",
        "updatable": false,
        "deletable": false,
        "renameable": false
      }
    }
  }
}


Need long-term technical maintenance or remote troubleshooting?

I am a PHP / Go backend engineer with 15+ years of experience, focused on existing system maintenance, bug fixing, performance optimization, server troubleshooting, WordPress maintenance, and small feature iterations.

If your project is facing any of the following issues, we can start with a small troubleshooting task first:

  • ✅ PHP / Laravel / Yii2 legacy systems without active maintenance
  • ✅ Go / Gin backend APIs that need troubleshooting or optimization
  • ✅ Slow, broken, or unstable WordPress websites
  • ✅ Nginx / MySQL / Redis / Linux server issues
  • ✅ CDN / Cloudflare / DNS / HTTPS configuration problems
  • ✅ Long-term remote technical support or part-time maintenance

More details: About Me & Collaboration

WeChat: 13980074657
Email: shuijingwanwq@gmail.com
Telegram: @shuijingwan
GitHub: https://github.com/shuijingwan

评论

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.