Skip to content

Commit b9c9270

Browse files
committed
Allow Clipboard to respond to new content directly
1 parent 2153a68 commit b9c9270

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

components/dash-core-components/src/components/Clipboard.react.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@ export default class Clipboard extends React.Component {
2626
};
2727
}
2828

29+
componentDidUpdate(prevProps) {
30+
// If the data hasn't changed, do nothing.
31+
if (!this.props.content || this.props.content === prevProps.content) {
32+
return;
33+
}
34+
// If the data has changed, copy to clipboard
35+
this.copyToClipboard();
36+
}
37+
2938
// stringifies object ids used in pattern matching callbacks
3039
stringifyId(id) {
3140
if (typeof id !== 'object') {

0 commit comments

Comments
 (0)