Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Sep 22, 2025

The enable_webview_click setting in Enterprise WeChat custom workbench was not working properly when H5 elements inside the webview needed to capture click events. The issue occurred because null Boolean values were being serialized as "enable_webview_click": null in the JSON payload instead of being omitted entirely.

Problem

When enableWebviewClick or hideTitle Boolean fields were null in WxCpAgentWorkBench, they were being serialized as explicit null values in the JSON:

{
  "webview": {
    "enable_webview_click": null,
    "hide_title": null
  }
}

This caused the WeChat Enterprise API to not properly handle the webview click functionality, preventing H5 element click events from being captured even when the setting appeared to be configured correctly.

Solution

Added null checks for Boolean fields in both handle() and handleBatch() methods, following the same pattern already used for replaceUserData:

if (this.enableWebviewClick != null) {
  webview.addProperty("enable_webview_click", this.enableWebviewClick);
}
if (this.hideTitle != null) {
  webview.addProperty("hide_title", this.hideTitle);
}

Now when these fields are null, they are omitted from the JSON entirely, allowing the WeChat API to apply proper defaults. When explicitly set to true or false, they work as expected.

Fixes #3697.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] 企业微信自定义工作台,enable_webview_click 设置无效 Fix Enterprise WeChat workbench enable_webview_click null handling Sep 22, 2025
Copilot AI requested a review from binarywang September 22, 2025 16:47
@binarywang binarywang marked this pull request as ready for review September 23, 2025 02:40
@binarywang binarywang merged commit 6fc1720 into develop Sep 23, 2025
1 check passed
@binarywang binarywang added this to the 4.7.8 milestone Sep 23, 2025
@binarywang binarywang deleted the copilot/fix-3697 branch September 23, 2025 02:43
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.

企业微信自定义工作台,enable_webview_click 设置无效

2 participants