Meteor不渲染css,并且在使用外部DDP Meteor实例时不断重新加载应用程序

Meteor does not render css and keeps reloading the app when using external DDP Meteor instance

本文关键字:Meteor 新加载 应用程序 加载 实例 外部 css DDP      更新时间:2023-09-26

我试图通过各种方式找出原因,以及这种情况是如何发生的,但我似乎无法弄清楚。我已经在freenode上的#流星上问了这个问题,但那个频道有点害怕。

问题是,当我使用第二个流星应用程序作为DDP源时,我的应用程序停止渲染css并继续重新加载页面。(DDP_DEFAULT_CONNECTION_URL)。

好吧,它会在一瞬间渲染css,然后再次重置,css完全从browser/dom中消失。

我把我的源代码放在github上,无法呈现css的应用程序是:github.com/mdahiemstra/tripster/tree/master/src/app

流星ddp服务器为:github.com/mdahiemstra/tripster/tree/master/src/api

相当标准的流星设置,没有什么太花哨的。当我不包括DDP连接url时,应用程序做得很好。

我也在网上放了一个演示,看到它在行动中失败了:应用程序:http://oozio.nl:5000/(使用流星应用程序"api"的DDP)

提前感谢您的帮助/建议!

--编辑在#metroe上一位irc用户的帮助下,我们通过删除自动更新暂时解决了这个问题,但这很难解决,我认为这是一个核心的流星错误。

不要使用DDP_DEFAULT_CONNECTION_URL,而是使用DDP.connect():

DDPConnection = (Meteor.isClient) ? DDP.connect('http://myOtherServer.com') : {};
if(Meteor.isClient) {
    // set the new DDP connection to all internal packages, which require one
    Meteor.connection = DDPConnection;
    Accounts.connection = Meteor.connection;
    Meteor.users = new Mongo.Collection('users');
    Meteor.connection.subscribe('users');
}
// When creating a collection use:
posts = new Mongo.Collection("posts", DDPConnection);
// And to subscribe use the DDP connection
DDPConnection.subscribe("mySubscription");