前端:拒单提示的空文案不再返回空串

- `directTurnRejectionNotice` 认得的拒单在宿主文案为空白时返回 `null`,不再返回空串:`''` 显示不出任何提示,却会被按 `!== null` 判据的调用方当成"有提示"
- 补注释把"有提示"的判据说清:要么给一条能显示的话,要么给 `null`
This commit is contained in:
2026-09-24 14:48:10 +08:00
parent 8d635c2ff7
commit 2ce96a73f0
@@ -91,6 +91,10 @@ export function readDirectTurnRejection(
*
* 名单只放"用户自己就能改、且不需要宿主诊断"的变体:`environmentNotReady` /
* `hostStateUnavailable` 这类是宿主 / 环境事实,必须走上报通道,所以不在这里。
*
* 空文案按"没有提示"处理:这个函数要么给一条能显示的话,要么给 `null`——宿主给不出可展示的文案
* 时返回 `null`,而不是让调用方拿到一条空串(`''` 显示不出任何东西,却会被按 `!== null` 判据的
* 调用方当成"有提示")。
*/
export function directTurnRejectionNotice(
rejection: DirectTurnRejection,
@@ -104,7 +108,7 @@ export function directTurnRejectionNotice(
case 'permissionRejected':
case 'inputRejected':
case 'contentEmpty':
return rejection.message.trim();
return rejection.message.trim() || null;
default:
return null;
}