[bug(?)]: future state declaration's data not passed/merged to/with loaded child state
I ran into a case where I was assuming that the "future" declaration's data would continue to be used once the child route was loaded, but that didn't seem to be the case.
// this declaration is no longer used once the child module has been loaded.
export const demoAppFutureState: Ng2StateDeclaration = {
name: 'demo.app.**',
url: '/app',
loadChildren: () => import('./modules/app/demo.app.module').then((m) => m.DemoAppModule),
data: demoAppStateData
};
I guess internally once the child state is loaded that's the one it will continue to use. My use case is I'm using authentication hooks to prevent the route from being accessible from anyone who isn't logged in. It is in the future state to prevent the client from lazy-loading the module until they are logged in.
The idea situation I think would be to pass the future's data to the child data if it isn't provided in the child at all.
As a workaround I have just exported/imported the data and provided it to each of the declarations.
Relevant commit with workaround: https://github.com/dereekb/dbx-components/commit/320cf5e38df723ab7e8f49d47479559375faa0e0#diff-1a138ce447e8fb9e8d972b1bf51e38587077888e929b4f7d182211556fb610ff