kadirahq / fast-render

Render you app even before the DDP connection is live. - magic?
MIT License
560 stars 80 forks source link

Not working on 1.3.4.4 #176

Closed dnish closed 7 years ago

dnish commented 7 years ago

Hey, Fast Render seems to be broken on my 1.3.4.4 application with Iron Router. The Meteor.user() object isn't available on the initial page load, everything worked fine before upgrading from 1.2 to 1.3.

jschlieber commented 7 years ago

I'm also having issues with the latest fast-render and Meteor 1.3.4.4 (same with flow-router-ssr and react-router-ssr). Server side injected data isn't there at initial page load. Downgrading to fast-render@2.13.0 (kind of) solved those issues (as long as I don't make use of subs manager).

VitalyChe commented 7 years ago

It seems the FastRender injects the DDP messages correctly (when no connection yet) but the messages (came with html especially user data) never get processed and saved into collections due to Accounts _autoLoginEnabled=true. Enabled autoLogin is the first to send message (login) to the live data connection (token is taken from local storage) After that every message is buffered (that the FastRender injects) but is not processed due to _waitingForQuiescence (the first login message is there) until the connection is established

It happens when there is some delay before connection is established

SachaG commented 7 years ago

Has anybody found a fix for this? I can confirm this started happening with 1.3.3 by the way.

@abernix I saw you've been contributing to FR, maybe you'd have some input on the issue?

tmeasday commented 7 years ago

Looks like it already has been fixed: https://github.com/kadirahq/fast-render/pull/167 ?

tmeasday commented 7 years ago

You can turn off buffered DDP with Meteor.connection.bufferedWritesMaxAge = 0 to work around this, I would guess.

SachaG commented 7 years ago

Note that it's actually Meteor.connection._bufferedWritesMaxAge = 0 (on the client). Still doesn't fix the problem sadly :(

tmeasday commented 7 years ago

It was an issue with the fix for https://github.com/kadirahq/fast-render/pull/167 (https://github.com/kadirahq/fast-render/pull/167/files#r74189260)

I would suggest downgrading to 2.13.x and potentially using the bufferedWrites workaround (although your reproduction works for me without it).

tmeasday commented 7 years ago

(and the fix for this package is to revert the linked commit). cc @arunoda

arunoda commented 7 years ago

Thanks @tmeasday I'll experiment with this today and do a release. @SachaG could you verify that downgrading this solves your issue?

SachaG commented 7 years ago

Yes, I can confirm 2.13.0 doesn't have this problem.

SachaG commented 7 years ago

Hmm, that being said with 2.13.0 I seem to have reloading problems for non-logged-in users in Telescope. I'm not sure if it's a Telescope-specific issue though.

tmeasday commented 7 years ago

There could definitely be problems with 2.13 and 1.3.3 if you don't turn off DDP batching, I expect.

gbhrdt commented 7 years ago

Did you already look into this @arunoda ? :) this has pretty high severity for us right now.

queso commented 7 years ago

@arunoda: Any update on this? Kind of a blocker to launching a newer/faster SSR crater site....

dnish commented 7 years ago

Downgrading to 2.13.0 doesn't work very well (on some reloads everything works fine, on others I get a "expected document to change" error without having the initial user data).

dnish commented 7 years ago

Maybe somone here can check the fix https://github.com/kadirahq/fast-render/pull/184 on his local project? In my case, everything is working fine now without problems.

cd your-meteor-project/packages
git clone https://github.com/dnish/fast-render
cd .. && meteor add meteorhacks:fast-render
gbhrdt commented 7 years ago

@dnish I just tested your fix, seems to be working for me, thanks!

arunoda commented 7 years ago

@dnish Hey thanks a lot for your fix. I just got it and did a release as v2.16.0. Try that.

Thanks all for helping on this.