I think initializerIds isn't a good name. It's not clear what this is referring to for a dev creating a brand new app for the first time. I'd rather change it to pluginInitializerRouteIds ow something like that.
Would be nice to show an error (in the console or in the build process, I'd prefere the second) when a user defines a initializer without adding the plugin to the appSetup plugins array.
I think the filter is unnecessary if we go with the error approach. The plugin initializerId is not in initializers? Break and show an error
Can fire all actions in parallel. await Promise.all([...routeInitializerActions])
When 2 plugins have the same initializerId the warning in the appSetup works nice. But if the dev tries to add an id to the createRouteinitializerIds array and that id is not unique we should fire an error. Firing an error instead of a warning in the appSetup is an option too. It's very confusing to execute multiple actions from the same id.
It's not clear how do I use a view route from a plugin in the app. For example, if I have a /tesplugin route in my testplugin plugin, how do I tell my testapp to use tesplugins's/testplugin route when we hit the /testplugin route within the app?
We should document that, due to the nature of yarn monorepos, when the dev creates a plugin it should run yarn in the root before using it in an app.
Agreed. The app should break if some given plugin initializer id is not defined.
The filter is required to execute the initializers from the ids array. Not all initializers will be executed for each route, so we need to filter what will be used. Makes sense? However, instead of using the array filter, i'll manually filter the existing initializers in a for of loop, and if some initializer is not defined, an error will be thrown.
Nice.
You can use the mergeRoutes util like we used before the plug and play setup. I'll move that util to our core router so more apps can use it.
initializerIds
isn't a good name. It's not clear what this is referring to for a dev creating a brand new app for the first time. I'd rather change it topluginInitializerRouteIds
ow something like that.initializer
without adding the plugin to theappSetup
plugins array.await Promise.all([...routeInitializerActions])
initializerId
the warning in theappSetup
works nice. But if the dev tries to add an id to thecreateRoute
initializerIds
array and that id is not unique we should fire an error. Firing an error instead of a warning in theappSetup
is an option too. It's very confusing to execute multiple actions from the same id./tesplugin
route in mytestplugin
plugin, how do I tell mytestapp
to usetesplugins's
/testplugin
route when we hit the/testplugin
route within the app?yarn
in the root before using it in an app.