-
Notifications
You must be signed in to change notification settings - Fork 390
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Outlets duplicated in Spartacus 6 #17711
Comments
Me pasa lo mismo siempre que uso el método provideOutlet(). Por ejemplo: provideOutlet({ |
Is there any investigation on this issue or a workaround? |
I had the same issue during the upgrade to the 5 version. Here's what I found: Issue: Component duplication may occur if the outlet configuration module is imported multiple times (either indirectly or directly) within the SpartacusFeaturesModule. // Module A
@NgModule({
imports: [...],
providers: [
provideOutlet({
id: customOutlets.TEST,
component: TestComponent,
}),
]
})
export class ModuleA { }
// Module B
@NgModule({
imports: [ModuleA],
})
export class ModuleB { }
// Module C
@NgModule({
imports: [ModuleA],
})
export class ModuleC { }
// Spartacus feature module
@NgModule({
imports: [
ModuleB, // This line will create the first TestComponent
ModuleC, // This will create the second TestComponent
],
})
export class SpartacusFeaturesModule { } Solutions:
// Module A
@NgModule({
imports: [...], // provideOutlet config was removed from this module
declarations: [...],
exports: [TestComponent],
})
export class ModuleA { }
// Module B
@NgModule({
imports: [ModuleA],
})
export class ModuleB { }
// Module C
@NgModule({
imports: [ModuleA],
})
export class ModuleC { }
// OutletConfigModule (Provide outlet configurations here)
@NgModule({
imports: [ModuleA],
providers: [
provideOutlet({
id: customOutlets.TEST,
component: TestComponent,
}),
]
})
export class OutletConfigModule { }
// Spartacus feature module
@NgModule({
imports: [
ModuleB,
ModuleC,
OutletConfigModule // This line will create the TestComponent
],
})
export class SpartacusFeaturesModule { } |
@sebospc do any of these modules use |
@kpawelczak No, the modules in the example are eager modules but they could be lazy modules |
@sebospc |
Ensure that |
@sebospc |
@sebospc I believe this is as you said because |
Describe the bug
Outlets are duplicated post Spartacus upgrade 6.2
Tell us the version of Spartacus
To Reproduce
Steps to reproduce the behavior:
Expected behavior
This component shouldn't be duplicated
Screenshots
Desktop (please complete the following information):
Additional context
The project was initially on spartacus 4.3 and has been migrated to 6.2.
The text was updated successfully, but these errors were encountered: