tableau / embedding-api-v3-guide

migration guide for moving to embedding api v3
MIT License
28 stars 9 forks source link

FirstInteractive event randomly not raised on Google Chrome #32

Closed florent-guinard closed 2 years ago

florent-guinard commented 2 years ago

Context of the issue

We're using the Embedding API to embed Tableau Vizs in a basic web application (static HTML page, vanilla JavaScript). Those Vizs are initialized via JavaScript. We're adding a FirstInteractive event listener to the Viz to perform additional actions once the Viz is properly loaded (retrieve filters and parameters, ...). We use the same page to display multiple embedded Vizs, one at a time.

Description of the issue

Randomly, the FirstInteractive event won't be raised, and the function given as the "listener" argument won't be called even if we wait for multiple minutes:

Reproduction Steps

A basic, static web application is hosted on a web server (in this example we're using python's http server by running "python -m http.server" in the web application folder) :

index.html

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Hello World!</title>
  <!-- Import the webpage's javascript file -->
  <script type="module" src="/script.js"></script>
</head>
<body>
  <div id="tableauViz"></div>
  <button id="load">
    Load
  </button>
</body>
</html>

script.js

import { TableauViz, TableauEventType } from "https://embedding.tableauusercontent.com/preview/tableau.embedding.3.latest.beta.js";
const vizs = [
  "https://10ax.online.tableau.com/t/<site>/views/<Workbook>/<Sheet>"
];
let viz;
async function firstInteractiveListener(_event) {
    console.log("First interactive ");
}
function loadViz() {
  viz = new TableauViz();
  viz.src = vizs[0];
  document.getElementById('tableauViz').innerHTML = '';
  document.getElementById('tableauViz').appendChild(viz);
  viz.addEventListener(TableauEventType.FirstInteractive, firstInteractiveListener);
}
const btn = document.getElementById("load"); // Get the button from the page
// Detect clicks on the button
if (btn) {
  btn.onclick = function () {
    loadViz();
  };
}

first_interactive.webm

Transcript of the video:

Web application: firstInteractive.zip

Workbook used: FirstInteractive_Workbook.zip

This issue is quite impactful for us as we're leveraging this "FirstInteractive" event to make sure that the Viz is properly loaded before automatically retrieving and displaying its information (Filters, Parameters, Data...).

illonage commented 2 years ago

Hi Florent - Thank you for opening an issue. It is indeed a bug, we just created one internally. For future reference, the bug number is 1431210

mmuttreja-tableau commented 2 years ago

Thanks for filling the bug. This is fixed in our 22.3 Release, you can test it off 10ax in a few days.

florent-guinard commented 2 years ago

@mmuttreja-tableau Thanks for your feedback and for fixing the issue !

It indeeds looks like the issue is fixed on 10ax, we'll perform additional tests and close the issue if everything is working properly.

florent-guinard commented 2 years ago

I confirm that the issue is now fixed on the 10ax preview site using the 3.3 Embedding API.