mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
(core) Fix CustomWidget nbrowser test
Summary: - test/nbrowser/CustomFilter keeps randomly fail on my local dev - it failed with `Cannot read property of null (reading 'postMessage`)` at line below: `this._rpc.setSendMessage(msg => this._iframe?.contentWindow!.postMessage(msg, '*'));` - I understand it was trying to send message before even the iframe was properly mounted - telling rpc to wait for the other end to send ready() successfully differ send message until everything's mounted. Test Plan: - should not break anything and test/nbrowser/CustomFilter should stop failing Reviewers: jarek Reviewed By: jarek Subscribers: jarek Differential Revision: https://phab.getgrist.com/D3510
This commit is contained in:
parent
51ff72c15e
commit
808aacdc52
@ -68,6 +68,9 @@ export class WidgetFrame extends DisposableWithEvents {
|
|||||||
// Build RPC object and connect it to iframe.
|
// Build RPC object and connect it to iframe.
|
||||||
this._rpc = new Rpc({});
|
this._rpc = new Rpc({});
|
||||||
|
|
||||||
|
// queue until iframe's content emit ready() message
|
||||||
|
this._rpc.queueOutgoingUntilReadyMessage();
|
||||||
|
|
||||||
// Register outgoing message handler.
|
// Register outgoing message handler.
|
||||||
this._rpc.setSendMessage(msg => this._iframe?.contentWindow!.postMessage(msg, '*'));
|
this._rpc.setSendMessage(msg => this._iframe?.contentWindow!.postMessage(msg, '*'));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user