Skip to content

Commit

Permalink
fix: fetch visualization always when caching
Browse files Browse the repository at this point in the history
A previous fix for an item flashing issue caused the offline cache to
lack the request for the visualizations.
The fix looks at the recording state and triggers a fetch that can be
recorded.
  • Loading branch information
edoardo committed Jun 5, 2024
1 parent 74c9b19 commit 32bcaa1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/components/Item/VisualizationItem/Item.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,15 @@ class Item extends Component {
this.setState({ configLoaded: true })
}

componentDidUpdate(prevProps) {
if (
this.props.isRecording &&
this.props.isRecording !== prevProps.isRecording
) {
apiFetchVisualization(this.props.item)
}
}

isFullscreenSupported = () => {
const el = getGridItemElement(this.props.item.id)
return !!(el?.requestFullscreen || el?.webkitRequestFullscreen)
Expand Down Expand Up @@ -322,6 +331,7 @@ Item.propTypes = {
dashboardMode: PropTypes.string,
gridWidth: PropTypes.number,
isEditing: PropTypes.bool,
isRecording: PropTypes.bool,
item: PropTypes.object,
itemFilters: PropTypes.object,
setActiveType: PropTypes.func,
Expand Down
1 change: 1 addition & 0 deletions src/pages/view/ItemGrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ const ResponsiveItemGrid = ({ dashboardId, dashboardItems }) => {
item={item}
gridWidth={gridWidth}
dashboardMode={VIEW}
isRecording={forceLoad}
onToggleItemExpanded={onToggleItemExpanded}
/>
</ProgressiveLoadingContainer>
Expand Down

0 comments on commit 32bcaa1

Please sign in to comment.