Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(api): replace deepMix with deepAssign #5232

Merged
merged 1 commit into from
Jun 26, 2023
Merged

fix(api): replace deepMix with deepAssign #5232

merged 1 commit into from
Jun 26, 2023

Conversation

pearmini
Copy link
Member

deepAssign

更新每个节点配置的方法为 deepAssign。

存在问题

之前更新使用的是 @antv/util 里面的 deepMix(src, target)。 但是当 target 的 key 为 undefined 的时候没有办法覆盖 src 中对应的 key,这导致无法去掉非默认的配置。

deepMix({ a: 1 }, { a: undefined }); // { a: 1 }

下面的例子更新失败。

chart.options({  encode: { color: 'red' } };
chart.options({ encode: { color: undefined } };
// 仍然是红色,没有变回默认的颜色
chart.options(); // {  encode: { color: 'red' }

开始使用

deepAssign({ a: 1 }, { a: undefined });  // { a: undefined }
chart.options({  encode: { color: 'red' } };
chart.options({ encode: { color: undefined } };
chart.options(); // {  encode: { color: 'undefined }

@pearmini pearmini requested a review from hustcc June 26, 2023 03:04
@hustcc
Copy link
Member

hustcc commented Jun 26, 2023

deepMix 这个方法迟早干掉。

@hustcc hustcc merged commit 7bf049c into v5 Jun 26, 2023
@hustcc hustcc deleted the fix/deepMix branch June 26, 2023 03:18
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.

2 participants