meteorhacks / meteor-inject-initial

Allow injection of arbitrary data to initial Meteor HTML page
Other
78 stars 11 forks source link

Late to inject #21

Closed Dielz98 closed 8 years ago

Dielz98 commented 8 years ago

When I did mongodb query to get the data for initial inject, it fail to inject. It succeed to inject in second load.

I suspect it is due to mongodb query takes time. When it late, so nothing to inject

gadicc commented 8 years ago

Can you provide a reproduction? A lot of things could be happening hear and it's hard to see without any code.

In general, everything runs in a fiber, so the query should complete before the http request is fully returned. If you're specifying the data directly (as opposed to with a function), it's possible a web request could squeeze in before the inject command has registered the data, but that should only be when first loading up.

Dielz98 commented 8 years ago

Sorry I guess it's my fault

I put injection inside Meteor.onConnection so i guess it's too late since injection do before onConection

gadicc commented 8 years ago

Great! Thanks for reporting back!