js-api-samples icon indicating copy to clipboard operation
js-api-samples copied to clipboard

React Error at Initializing: tableau.viz is not a constructor

Open Shah-Sahab opened this issue 3 years ago • 2 comments

Hi,

I have been trying [email protected] and everytime I create a viz object out of tableau I run into the following error,

tableau.viz is not a constructor

Question also listed on this link.

Is this a problem with this specific version? Or is there a bug or something wrong with the code?

Shah-Sahab avatar Jun 09 '21 23:06 Shah-Sahab

In the given code, you use: viz = new tableau.Viz(url)

However, the specification of tableau.Viz() function takes domNode, url and optionally options as its arguments and in that order. Since there is no function named tableau.Viz that takes url as its only argument, it shows as error.

noidwasavailable avatar Feb 08 '22 00:02 noidwasavailable

Try using window.tableau.Viz(*)

Also, ensuring that tableau was loaded using NextJS's <Script/> tag and which only triggered tableau-related functions after it was done loading helped me.

stoddabr avatar Jul 19 '22 22:07 stoddabr

bulk closing

jacalata avatar Mar 18 '23 05:03 jacalata