Fix Enterprise WeChat workbench enable_webview_click null handling #3711
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.
The
enable_webview_clicksetting 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": nullin the JSON payload instead of being omitted entirely.Problem
When
enableWebviewClickorhideTitleBoolean fields were null inWxCpAgentWorkBench, 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()andhandleBatch()methods, following the same pattern already used forreplaceUserData: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
trueorfalse, 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.