Tags: chris-han/PowerBI-JavaScript
Tags
Merged PR 101002: Fixing bootstrap bug.
Fixing a bug where /report/embed message is sent before bootstrap is complete.
**Repo:**
1) Call bootstrap.
2) Call report.embed immediately.
**Timing:**
1) Bootstrap starts.
2) iframe is not loaded yet ('load') event is not fired to the SDK.
3) powerbi.embed starts
4) powerbi.embed calls embedExisting because iframe already exists - it's fine.
5) embedExisting calls embed::load method which sends /report/load message to the SDK
6) iframe is loaded (bootstrap is done).
7) ('load') event handler calls embed::load method which sends /report/load message to the SDK - AGAIN
**Expected:**
/report/load is called one time only.
**Acutal**
/report/load is called twice - first time before iframe is ready is a BUG.
**Fix**
Adding a flag which saves the state of the iframe (loaded/not loaded).
If iframe is not loaded, avoid sending the postMessage.
We need the load method to send the right config when it's called from 'load' event. For that, we save the last config per component, and post the load message with that config.
PreviousNext