Closed eric-burel closed 5 years ago
@SachaG However I don't get why this need calls to populate for components and routes, but not for Collections for example? Couldn't the Routes
object be always "ready" somehow, like Collections
?
Maybe getComponent
is obsolete now HOCs can work without the fragment being initialized first.
For routes it's because we need childRoutes
to be populated. I think we could just get those routes dynamically every times we iterate on Routes (it's actually called only once in start.jsx
).
Edit: I confirm getting routes dynamically Routes using a getRoutes
function does the trick, without adding more complexity. I'll PR that.
I've ended up adding a more generic startup.before
callback. We can put any operation that needs to be ran before routes and components population, as well as the initial rendering, eg adding routes dynamically, see the PR.
Hi,
Currently we can't
addRoute
in aMeteor.startup
call, because we can't guarantee the call to addRoute is made before we populate the Routes object. So ifaddRoute
is called after the populate call, they are ignored.So far I think the best solution is to add new callbacks,
populate.routes.before
andpopulate.components.before
that are guaranteed to run before those calls, instart.jsx
. This way we can be sure thataddRoute
is correctly called.We could also review whether populating is still necessary and why.
This is needed to implement the automated backoffice https://github.com/VulcanJS/Vulcan/issues/2176