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

LineAnnotation disappears on rerender #604

Closed
2 tasks done
gmmorris opened this issue Mar 25, 2020 · 3 comments · Fixed by #605
Closed
2 tasks done

LineAnnotation disappears on rerender #604

gmmorris opened this issue Mar 25, 2020 · 3 comments · Fixed by #605
Assignees
Labels
bug Something isn't working released on @18.1.x released Issue released publicly

Comments

@gmmorris
Copy link

gmmorris commented Mar 25, 2020

Describe the bug
A LineAnnotation on a chart disappears when the React component rerenders (for whatever reason, chart data is completely unchanged).

To Reproduce
See here: https://codesandbox.io/s/condescending-cloud-muq5e?from-embed

Steps to reproduce the behavior:

<Chart size={['100%', 200]} renderer="canvas">
            <Axis domain={{ max: 1200 }} id="left" position={Position.Left} />
            <LineSeries
              id={'all-documents'}
              data={[
                [1585126720460, 0],
                [1585126780460, 0],
                [1585126840460, 0],
                [1585126900460, 0],
                [1585126960460, 0],
                [1585128280460, 0],
                [1585128340460, 0],
                [1585128400460, 2],
                [1585128460460, 2],
                [1585128520460, 2],
              ]}
              xAccessor={0}
              yAccessors={[1]}
            />
            <LineAnnotation
              key={'threashold'}
              id={'threashold'}
              domainType={AnnotationDomainTypes.YDomain}
              dataValues={[{ dataValue: 1000, details: 'threashold' }]}
            />
          </Chart>

Simply place this chart in a react component - one it's second render the LineAnnotation will disappear.

Expected behaviour
LineAnnotation should rerender as well. :)

Screenshots
chart

Version (please complete the following information):

  • OS: OSX
  • Browser: chrome
  • Elastic Charts: 18.1.0

Additional context
Discovered within Kibana on Master

Kibana Cross Issues
elastic/kibana#60955

Checklist

Delete any items that are not applicable to this issue.

  • every related Kibana issue is listed under Kibana Cross Issues list
  • kibana cross issue tag is associated to the issue if any kibana cross issue is present
@gmmorris gmmorris added the bug Something isn't working label Mar 25, 2020
@markov00 markov00 self-assigned this Mar 25, 2020
markov00 added a commit to markov00/elastic-charts that referenced this issue Mar 25, 2020
The `LineAnnotation` component doesn't use the `specComponentFactory` because it render the marker
if available. We have to always keep the spec updating the state on every lifecycle thus removing
the deepEqual check on the shouldComponentUpdate did the trick.

fix elastic#604
markov00 added a commit that referenced this issue Mar 26, 2020
The `LineAnnotation` component doesn't use the `specComponentFactory` because it render the marker if available. We have to always keep the spec updating the state on every lifecycle thus removing the deepEqual check on the shouldComponentUpdate did the trick.

fix #604
@gmmorris
Copy link
Author

Thanks for the quick response 👍

markov00 pushed a commit that referenced this issue Mar 26, 2020
# [18.2.0](v18.1.0...v18.2.0) (2020-03-26)

### Bug Fixes

* **line_annotation:** keep the spec in state after chart rerender ([#605](#605)) ([43c13f1](43c13f1)), closes [#604](#604)

### Features

* **partition:** stroke configuration and linked label value font format ([#602](#602)) ([7dce0a3](7dce0a3))
@markov00
Copy link
Member

🎉 This issue has been resolved in version 18.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@markov00 markov00 added the released Issue released publicly label Mar 26, 2020
markov00 pushed a commit that referenced this issue Mar 26, 2020
## [18.1.1](v18.1.0...v18.1.1) (2020-03-26)

### Bug Fixes

* **line_annotation:** keep the spec in state after chart rerender ([#605](#605)) ([43c13f1](43c13f1)), closes [#604](#604)
@markov00
Copy link
Member

🎉 This issue has been resolved in version 18.1.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

AMoo-Miki pushed a commit to AMoo-Miki/OpenSearch-Dashboards that referenced this issue Feb 10, 2022
# [18.2.0](elastic/elastic-charts@v18.1.0...v18.2.0) (2020-03-26)

### Bug Fixes

* **line_annotation:** keep the spec in state after chart rerender ([opensearch-project#605](elastic/elastic-charts#605)) ([22296c6](elastic/elastic-charts@22296c6)), closes [opensearch-project#604](elastic/elastic-charts#604)

### Features

* **partition:** stroke configuration and linked label value font format ([opensearch-project#602](elastic/elastic-charts#602)) ([24d0e71](elastic/elastic-charts@24d0e71))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released on @18.1.x released Issue released publicly
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants