I have a webpage that displays a react component, TableauReports, which shows a tableau dashboard.
This is the TableaReports
component:
const TableauReports = ({ selectedBtn }) => {
console.log(`selectedBtn = ${selectedBtn}`)
return (
<div className='tableauPlaceholder' style={{ width: '1400px', height: '950px' }}>
<object className='tableauViz' width='1400' height='950' style={{ display: 'none' }}>
<param name='host_url' value='https%3A%2F%2Ftableauanalytical-east.cloud.privateSite.com%2F' />
<param name='embed_code_version' value='3' />
<param name='site_root' value='/t/A_B_C' />
<param name='name' value={`Reports/${selectedBtn.replace(" ", "")}`} />
<param name='tabs' value='yes' />
<param name='toolbar' value='yes' />
<param name='showAppBanner' value='false' />
</object>
</div>
)
}
export default TableauReports
And within my app.jsx
the component is accessed like so:
const [selectedTableauBtn, setSelectedTableauBtn] = useState(constants.TableauButtons[2]);
// some code that sets the selectedTableauBtn...
<TableauReports selectedBtn={selectedTableauBtn}></TableauReports>
The component indeed is accessed every time selectedTableauBtn
changes as the console.log in TableauReports
is triggered and it prints the correct value. The problem is: the tableau dashboard doesn't switch tabs as it should. In fact, the dashboard doesn't rerender at all! Why isn't the dashboard rerendering and displaying the updated visualization as specified by the input selectedBtn
?