Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use correct plugin for active type when resizing #1626

Merged
merged 2 commits into from
Mar 10, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions src/components/Item/VisualizationItem/Item.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,11 @@ export class Item extends Component {
)
}
// call resize on Map item
pluginResize(this.props.item, this.state.isFullscreen)
pluginResize(
this.props.item.id,
this.getActiveType(),
this.state.isFullscreen
)
}
}

Expand All @@ -152,7 +156,12 @@ export class Item extends Component {
!!document.fullscreenElement ||
!!document.webkitFullscreenElement,
},
() => pluginResize(this.props.item, this.state.isFullscreen)
() =>
pluginResize(
this.props.item.id,
this.getActiveType(),
this.state.isFullscreen
)
)
}

Expand Down Expand Up @@ -197,7 +206,8 @@ export class Item extends Component {
return (
height -
this.headerRef.current.clientHeight -
this.itemHeaderTotalMargin
this.itemHeaderTotalMargin -
this.itemContentPadding
)
}

Expand Down
8 changes: 4 additions & 4 deletions src/components/Item/VisualizationItem/Visualization/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ export const load = async (
loadPlugin(plugin, config, credentials)
}

export const resize = (item, isFullscreen) => {
const plugin = getPlugin(item.type)
export const resize = (id, type, isFullscreen = false) => {
const plugin = getPlugin(type)

if (plugin && plugin.resize) {
plugin.resize(getGridItemDomId(item.id), isFullscreen)
if (plugin?.resize) {
plugin.resize(getGridItemDomId(id), isFullscreen)
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/ItemGrid/EditItemGrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const EditItemGrid = ({

// call resize on the item component if it's a plugin type
if (dashboardItem && isVisualizationType(dashboardItem)) {
pluginResize(dashboardItem)
pluginResize(dashboardItem.id, dashboardItem.type)
}
}

Expand Down