From 80e91a3c5e1122b8e25261d490199e1e47e654f5 Mon Sep 17 00:00:00 2001 From: Paul Kaplan Date: Tue, 14 Jan 2020 10:54:30 -0500 Subject: [PATCH] Update library-item to handle 3.0 or 2.0 library formats --- src/containers/library-item.jsx | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/containers/library-item.jsx b/src/containers/library-item.jsx index 8881a57cc..51e105053 100644 --- a/src/containers/library-item.jsx +++ b/src/containers/library-item.jsx @@ -92,14 +92,16 @@ class LibraryItem extends React.PureComponent { this.setState({iconIndex: nextIconIndex}); } curIconMd5 () { + const iconMd5Prop = this.props.iconMd5; if (this.props.icons && this.state.isRotatingIcon && - this.state.iconIndex < this.props.icons.length && - this.props.icons[this.state.iconIndex] && - this.props.icons[this.state.iconIndex].baseLayerMD5) { - return this.props.icons[this.state.iconIndex].baseLayerMD5; + this.state.iconIndex < this.props.icons.length) { + const icon = this.props.icons[this.state.iconIndex] || {}; + return icon.md5ext || // 3.0 library format + icon.baseLayerMD5 || // 2.0 library format, TODO GH-5084 + iconMd5Prop; } - return this.props.iconMd5; + return iconMd5Prop; } render () { const iconMd5 = this.curIconMd5(); @@ -151,7 +153,8 @@ LibraryItem.propTypes = { iconRawURL: PropTypes.string, icons: PropTypes.arrayOf( PropTypes.shape({ - baseLayerMD5: PropTypes.string + baseLayerMD5: PropTypes.string, // 2.0 library format, TODO GH-5084 + md5ext: PropTypes.string // 3.0 library format }) ), id: PropTypes.number.isRequired,