mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Don't try to use WebAppInternals.refreshableAssets until it's ready.
`refreshableAssets` gets set from the `generateBoilerplate` call in webapp's `main` function. `updateVersions` in autoupdate gets called in a startup hook, which runs before `main`. So we need to wait until webapp is "more ready" (i.e. `onListening`) to try to use `WebAppInternals.refreshableAssets`.
This commit is contained in:
@@ -108,30 +108,35 @@ var updateVersions = function (shouldReloadClientProgram) {
|
||||
}});
|
||||
}
|
||||
|
||||
if (! ClientVersions.findOne({_id: "version-refreshable"})) {
|
||||
ClientVersions.insert({
|
||||
_id: "version-refreshable",
|
||||
version: Autoupdate.autoupdateVersionRefreshable,
|
||||
assets: WebAppInternals.refreshableAssets
|
||||
});
|
||||
} else {
|
||||
ClientVersions.update("version-refreshable", { $set: {
|
||||
version: Autoupdate.autoupdateVersionRefreshable,
|
||||
assets: WebAppInternals.refreshableAssets
|
||||
// Use `onListening` here because we need to use
|
||||
// `WebAppInternals.refreshableAssets`, which is only set after
|
||||
// `WebApp.generateBoilerplate` is called by `main` in webapp.
|
||||
WebApp.onListening(function () {
|
||||
if (! ClientVersions.findOne({_id: "version-refreshable"})) {
|
||||
ClientVersions.insert({
|
||||
_id: "version-refreshable",
|
||||
version: Autoupdate.autoupdateVersionRefreshable,
|
||||
assets: WebAppInternals.refreshableAssets
|
||||
});
|
||||
} else {
|
||||
ClientVersions.update("version-refreshable", { $set: {
|
||||
version: Autoupdate.autoupdateVersionRefreshable,
|
||||
assets: WebAppInternals.refreshableAssets
|
||||
}});
|
||||
}
|
||||
}
|
||||
|
||||
if (! ClientVersions.findOne({_id: "version-cordova"})) {
|
||||
ClientVersions.insert({
|
||||
_id: "version-cordova",
|
||||
version: Autoupdate.autoupdateVersionCordova,
|
||||
refreshable: false
|
||||
});
|
||||
} else {
|
||||
ClientVersions.update("version-cordova", { $set: {
|
||||
version: Autoupdate.autoupdateVersionCordova
|
||||
}});
|
||||
}
|
||||
if (! ClientVersions.findOne({_id: "version-cordova"})) {
|
||||
ClientVersions.insert({
|
||||
_id: "version-cordova",
|
||||
version: Autoupdate.autoupdateVersionCordova,
|
||||
refreshable: false
|
||||
});
|
||||
} else {
|
||||
ClientVersions.update("version-cordova", { $set: {
|
||||
version: Autoupdate.autoupdateVersionCordova
|
||||
}});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Meteor.publish(
|
||||
|
||||
Reference in New Issue
Block a user