Skip to content

Commit

Permalink
fix: fetch visualization always when caching (#2988) (#2992)
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.

(cherry picked from commit c1201fa)

Co-authored-by: Edoardo Sabadelli <[email protected]>
  • Loading branch information
janhenrikoverland and edoardo authored Jun 5, 2024
1 parent c2854b1 commit cb2e26c
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 @@ -104,6 +104,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 @@ -280,6 +289,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 cb2e26c

Please sign in to comment.