-
Notifications
You must be signed in to change notification settings - Fork 19.6k
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(line): Ensure null check to avoid Cannot set properties of null (setting 'hoverState')
error
#20563
base: master
Are you sure you want to change the base?
Conversation
Thanks for your contribution! |
setStatesFlag(this._polyline, toState); | ||
polygon && setStatesFlag(polygon, toState); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the first call to setStatesFlag
is not intentional. Removing the call fixes the error I was encountering since the second call has a null check
Cannot set properties of null (setting 'hoverState')
error
Thanks for your contribution. Can you add a test case for this fix? |
it('should not error on state change when polygon is not set', function () { | ||
lineView._polygon = null; | ||
expect(() => lineView._changePolyState('emphasis')).not.toThrow(); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test case would fail before the change in this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if this is the right place to put the tests, if it needs to move please let me know
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be better if you can provide a reproduction demo. Please refer to
https://github.com/apache/echarts/wiki/How-to-make-a-pull-request#add-a-test-case
Thanks @plainheart, I have added a couple test cases |
Brief Information
This pull request is in the type of:
What does this PR do?
This PR fixes the following error:
By removing a redundant call to
setStatesFlag
missing a null/undefined checkFixed issues
I haven't created a separate issue, but I can if you would like
Details
Before: What was the problem?
There can be a race condition between the tooltip and
instance.dispatchAction({type: 'downplay'})
that causes the chart to freeze with an exceptionAfter: How does it behave after the fixing?
There is no longer an error
Document Info
One of the following should be checked.
Misc
ZRender Changes
Related test cases or examples to use the new APIs
N.A.
Others
Merging options
Other information