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(scrollbar): 修复了由于getYScales方法中去重方法错误导致的 scrollbar会在特定情况下失效(#3569) #3570

Merged
merged 1 commit into from Sep 8, 2021

Conversation

wenjingyuer
Copy link
Contributor

Checklist
  • npm test passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Description of change

修复详情参见🔎
https://www.yuque.com/docs/share/7def9b80-f24c-4d2d-95f9-5a936a49ea5f?# 《G2 Scroball的bug》

@visiky
Copy link
Member

visiky commented Aug 14, 2021

看下这个?#3505

是否也会出现图例不正确的事情

@wenjingyuer
Copy link
Contributor Author

看下这个?#3505

是否也会出现图例不正确的事情

#3569 的问题是由于getYScales函数中去重方法错误导致,在此pr #3570 中进行了修复。
#3505 中提到的问题我之前并未发现,#3505 修复的bug和 #3569 并无关联,2次pr对应修改的代码文件也不一样

@wenjingyuer
Copy link
Contributor Author

@visiky 周末还在做Review,辛苦啦,Happy Chinese Valentine's day 🥳

const yScale = g.getYScale();
const field = yScale.field;
if (!tmpMap[field]) {
tmpMap[field] = true;
return yScale;
yScales.push(yScale);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个问题的原因是之前 yScales 数组中中可能有 undefined?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是的,因为之前使用的是map方法去重,但实际上如果map回调函数没有手动return的话,默认会返回undefined
[1,1,2].map(item=>{
if(item!==1){
return item
}
})
// [undefined, undefined, 2]

@hustcc hustcc self-requested a review August 26, 2021 02:58
@hustcc hustcc merged commit 28280ee into antvis:master Sep 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants