kadirahq / fast-render

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

Buffered livedata fix #167

Closed abernix closed 8 years ago

abernix commented 8 years ago

Since meteor/meteor#5680 provides (awesome) support for buffered DDP, two (what seem to be) false-positive issues popped up in fast-render. Nothing seemed actually wrong unless you were trying to do things mid-CPU tick (like tests or error checking). Both of these were found during accidental release of that PR in Meteor 1.3.2.1/2. The PR will be back in Meteor 1.3.3 and this should hopefully address the problems.

  1. flow-router started throwing a false-positive You can't use reactive data sources like Session inside the '.subscriptions' method error (despite the lack of subscriptions) because of the lack of flushing on the same tick in FastRender.init. Calling the connection's _flushBufferedWrites (if it exists), fixed this issue with no changes necessary to flow-router. The (incorrectly) thrown error was affecting subscriptions ability to become ready because the Tracker.
  2. fast-render package tests started failing because livedata updates were not happening in the same tick as the test that was checking them. I changed the tests that do this to use Tinytest.addAsync and wait until the default _bufferedWritesInterval milliseconds have passed. This value is hardcoded to 5 in livedata, so I used that here too.

Fixes #166

abernix commented 8 years ago

Should be completely backwards compatible too!

arunoda commented 8 years ago

Hey. Thanks for the awesome fix.

arunoda commented 8 years ago

Published as v2.14.0. Will do a releases to FlowRouter as well.