Skip to content

Commit 5ea2ed2

Browse files
authored
Merge branch 'dev' into fix/layout-list-persistence
2 parents 36be8a5 + 0d4913d commit 5ea2ed2

File tree

2 files changed

+28
-5
lines changed

2 files changed

+28
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
1111
## Fixed
1212
- [#3353](https://github.com/plotly/dash/pull/3353) Support pattern-matching/dict ids in `dcc.Loading` `target_components`
1313
- [#3371](https://github.com/plotly/dash/pull/3371) Fix allow_optional triggering a warning for not found input.
14+
- [#3379](https://github.com/plotly/dash/pull/3379) Fix dcc.Graph backward compatibility with dash 2.0 for ddk.Graph
1415

1516
# [3.1.1] - 2025-06-29
1617

components/dash-core-components/src/fragments/Graph.react.js

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,10 @@ import {
1313
import PropTypes from 'prop-types';
1414
import {graphPropTypes, graphDefaultProps} from '../components/Graph.react';
1515

16-
import LoadingElement from '../utils/LoadingElement';
17-
1816
/* global Plotly:true */
1917

2018
import ResizeDetector from '../utils/ResizeDetector';
19+
import LoadingElement from '../utils/LoadingElement';
2120

2221
/**
2322
* `autosize: true` causes Plotly.js to conform to the parent element size.
@@ -537,23 +536,46 @@ class PlotlyGraph extends Component {
537536
}
538537

539538
render() {
540-
const {className, id} = this.props;
539+
const {className, id, loading_state} = this.props;
541540
const style = this.getStyle();
542541

542+
if (window.dash_component_api) {
543+
return (
544+
<LoadingElement
545+
id={id}
546+
key={id}
547+
className={className}
548+
style={style}
549+
ref={this.parentElement}
550+
>
551+
<ResizeDetector
552+
onResize={this.graphResize}
553+
targets={[this.parentElement, this.gd]}
554+
/>
555+
<div
556+
ref={this.gd}
557+
style={{height: '100%', width: '100%'}}
558+
/>
559+
</LoadingElement>
560+
);
561+
}
543562
return (
544-
<LoadingElement
563+
<div
545564
id={id}
546565
key={id}
547566
className={className}
548567
style={style}
549568
ref={this.parentElement}
569+
data-dash-is-loading={
570+
(loading_state && loading_state.is_loading) || undefined
571+
}
550572
>
551573
<ResizeDetector
552574
onResize={this.graphResize}
553575
targets={[this.parentElement, this.gd]}
554576
/>
555577
<div ref={this.gd} style={{height: '100%', width: '100%'}} />
556-
</LoadingElement>
578+
</div>
557579
);
558580
}
559581
}

0 commit comments

Comments
 (0)