Carlos López - Hello TS team, I'm facing an iss...
# dev-help
c
Hello TS team, I'm facing an issue with programmatically update filters - i'm using
HostEvent.UpdateFilters
where the Liveboard Embed component trigger the
onLoad
event - the response of the trigger always throw and error `"No answer found." but seconds later the filter chips is updated.
a
message has been deleted
s
If you want, I can also give you a “queue host events until ready” utility so all early host events are buffered and replayed safely.
What you’re seeing is usually a timing mismatch between when the Liveboard UI reports loaded and when the internal “answer context” needed by
HostEvent.UpdateFilters
is fully ready.
HostEvent.UpdateFilters
is documented as updating an existing Liveboard filter. If triggered too early (even inside
onLoad
), it can throw
"No answer found."
while the async filter update still applies moments later. So your observation (error first, chips update seconds later) is consistent with that behavior. ### What to change 1. Keep using
HostEvent.UpdateFilters
, but don’t fire it immediately at first load tick. 2. Gate the call: - either with a small retry/backoff when
"No answer found."
appears, - or trigger only after the first stable post-load state in your app lifecycle. 3. Ensure the target filter already exists on the Liveboard (UpdateFilters updates existing chips).
Copy code
js
import {
  init,
  AuthType,
  LiveboardEmbed,
  HostEvent,
  EmbedEvent,
} from "@thoughtspot/visual-embed-sdk";

init({
  thoughtSpotHost: "https://your-ts-host",
  authType: AuthType.None,
});

const liveboard = new LiveboardEmbed("#ts-embed", {
  liveboardId: "YOUR_LIVEBOARD_ID",
});

liveboard.on(EmbedEvent.Load, async () => {
  const payload = {
    filter: {
      column: "date",
      oper: "EQ",
      values: ["JULY", "2023"],
      type: "MONTH_YEAR",
    },
  };

  const maxAttempts = 5;
  for (let attempt = 1; attempt <= maxAttempts; attempt++) {
    try {
      await liveboard.trigger(HostEvent.UpdateFilters, payload);
      console.log("Filter updated");
      break;
    } catch (e) {
      const msg = String(e?.message || e);
      if (!msg.includes("No answer found.") || attempt === maxAttempts) {
        console.error("UpdateFilters failed:", e);
        break;
      }
      await new Promise((r) => setTimeout(r, 300 * attempt)); // backoff
    }
  }
});

liveboard.render();
c
give the utility about queue host events until ready
r
Hi @Carlos López Just to confirm, are you still able to work with UpdateFilters successfully despite the "No answer found." error, since the filter chips eventually get updated ? I’ll check internally on why this warning/error is getting triggered even though the filters appear to be applied correctly.
c
Hey @Ruchi Anand - unfortunaly no, I have the same error - there many times when trigger the
onError
event when trigger the
HostEvent.UpdateFilters
r
What error are you getting? Can you share your embed code in CodeSandbox or somewhere similar?
c
@Ruchi Anand - I found the solution very similar what you mentioned - thanks!