alibaba / alibaba/ice

ice3组件style自定义属性传递bug

Open
#5,887 1 comment 0 reactions 1 assignee Claimed by @wssgcg1213 View on GitHub
bug
Dominant language
TypeScript
Stars
18.6k
Forks
2.1k
PR merge metrics
No merged PRs in 30d

Description

### Describe the bug

#### 表现
[F2组件有自定义style写法](https://f2.antv.antgroup.com/tutorial/shape-attrs#%E9%80%9A%E7%94%A8%E5%B1%9E%E6%80%A7),ice对style特殊处理导致数据转化异常
```

```
被解析传递到组件后,style值变成了
```
{
line: { strokeOpacity: 0},
grid: { strokeOpacity: 0},
label: { strokeOpacity: 0},
}
```
#### 原因分析
@ice/jsx-runtime/esm/index.js的[hijackElementProps](https://github.com/alibaba/ice/blob/v3.1.0/packages/jsx-runtime/src/index.ts#L31)方法用于处理兼容rpx单位写法,其中convertUnit方法存在cache逻辑,[但cache逻辑无法正确处理key是Object类型的数据](https://github.com/alibaba/rax/blob/master/packages/style-unit/src/index.js#L121),导致非首个属性的处理返回都是首个属性的结果,如输入 `{x:{a:1}, y:{b:2}, z:{c:3}} ` 返回 `{x:{a:1}, y:{a:1}, z:{a:1}}`

### Expected behavior

期望正常解析传递style属性数据

### Actual behavior

_No response_

### Version of ice.js

3.1.0

### Content of build.json or ice.config.mts

_No response_

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.