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
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions src/components/experiment-tracking/run-dataset/run-dataset.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { useMemo } from 'react';
import classnames from 'classnames';
import Accordion from '../accordion';
import PinArrowIcon from '../../icons/pin-arrow';
Expand Down Expand Up @@ -77,7 +77,12 @@ const RunDataset = ({
trackingData,
theme,
}) => {
if (!trackingData) {
const clonedTrackingData = useMemo(
() => structuredClone(trackingData),
[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 !!

);

if (!clonedTrackingData) {
return null;
}

Expand All @@ -87,7 +92,7 @@ const RunDataset = ({
'details-dataset--not-overview': activeTab !== 'Overview',
})}
>
{Object.keys(trackingData)
{Object.keys(clonedTrackingData)
.filter((group) => {
if (activeTab === 'Plots' && group === activeTab) {
return true;
Expand Down Expand Up @@ -122,7 +127,7 @@ const RunDataset = ({
layout="left"
size="large"
>
{trackingData[group].length === 0 && (
{clonedTrackingData[group].length === 0 && (
<div className="details-dataset__row">
<span
className="details-dataset__name-header"
Expand Down Expand Up @@ -165,7 +170,7 @@ const RunDataset = ({
</TransitionGroup>
</div>
)}
{trackingData[group].map((dataset) => {
{clonedTrackingData[group].map((dataset) => {
const { data, datasetType, datasetName, runIds } = dataset;

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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


const booleanTrackingData = {
JSONData: [
Expand Down
Loading