mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Avoid TDZ error from calling observe callbacks synchronously.
Should fix #10092.
This commit is contained in:
@@ -96,9 +96,17 @@ Autoupdate._retrySubscription = () => {
|
||||
},
|
||||
|
||||
onReady() {
|
||||
// Call checkNewVersionDocument with a slight delay, so that the
|
||||
// const handle declaration is guaranteed to be initialized, even if
|
||||
// the added or changed callbacks are called synchronously.
|
||||
const resolved = Promise.resolve();
|
||||
function check(doc) {
|
||||
resolved.then(() => checkNewVersionDocument(doc));
|
||||
}
|
||||
|
||||
const handle = ClientVersions.find().observe({
|
||||
added: checkNewVersionDocument,
|
||||
changed: checkNewVersionDocument
|
||||
added: check,
|
||||
changed: check
|
||||
});
|
||||
|
||||
function checkNewVersionDocument(doc) {
|
||||
|
||||
Reference in New Issue
Block a user