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 for Plotly chart not rendering #1701

Merged
merged 3 commits into from
Jan 15, 2024
Merged

Fix for Plotly chart not rendering #1701

merged 3 commits into from
Jan 15, 2024

Conversation

jitu5
Copy link
Contributor

@jitu5 jitu5 commented Jan 8, 2024

Description

Resolves issue under experiment tracking where Plotly graph is not rendering.

Screenshot 2024-01-08 at 9 55 32 a m

Development notes

Considering the nested nature of the trackingData, it could be a data immutability issue causing the problem. To address this, I created a deep copy of the trackingData using structuredClone and passed it to the <PlotlyChart> component.

Checklist

  • Read the contributing guidelines
  • Opened this PR as a 'Draft Pull Request' if it is work-in-progress
  • Updated the documentation to reflect the code changes
  • Added new entries to the RELEASE.md file
  • Added tests to cover my changes

@jitu5 jitu5 added the Javascript Pull requests that update Javascript code label Jan 8, 2024
@jitu5 jitu5 self-assigned this Jan 8, 2024
Copy link
Contributor

@rashidakanchwala rashidakanchwala left a comment

Choose a reason for hiding this comment

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

Amazing!! This has been a mind-boggling issue. We even faced this last year when building out metric plots. So glad it is solved.

Thanks a lot @jitu5

Copy link
Member

@tynandebold tynandebold left a comment

Choose a reason for hiding this comment

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

Great one!

Copy link
Contributor

@ravi-kumar-pilla ravi-kumar-pilla left a comment

Choose a reason for hiding this comment

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

Looking great and works well !! Nice to have this in the release note. Thank you @jitu5

@@ -3,6 +3,7 @@ import RunDataset from '.';
import { runs, trackingData } from '../../experiment-wrapper/mock-data';
import JSONObject from '../../json-object';
import { shallow, mount } from 'enzyme';
import 'core-js/stable/structured-clone';
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this required ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, structuredClone is not defined for jest test environment using NodeJS version below 17.0.0, Here its being pulled from core-js

@@ -77,7 +77,12 @@ const RunDataset = ({
trackingData,
theme,
}) => {
if (!trackingData) {
const clonedTrackingData = useMemo(
() => structuredClone(trackingData),
Copy link
Contributor

Choose a reason for hiding this comment

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

Awesome !!

@jitu5 jitu5 merged commit d2c91a1 into main Jan 15, 2024
5 checks passed
@jitu5 jitu5 deleted the fix/plotly branch January 15, 2024 13:31
@jitu5 jitu5 mentioned this pull request Jan 22, 2024
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Javascript Pull requests that update Javascript code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants