Skip to content

Commit a225eb5

Browse files
committed
Always return enabled for initial config
1 parent 9d4ca56 commit a225eb5

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

projects/core/src/lib/shared/helpers/component-config.helper.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { LoadingStateEnum, RegisteredComponent } from '@tailormap-viewer/shared'
22
import { BaseComponentConfigHelper, BaseComponentTypeEnum, ComponentBaseConfigModel, ComponentModel } from '@tailormap-viewer/api';
33
import { Store } from '@ngrx/store';
44
import { selectComponentsConfigForType, selectViewerLoadingState } from '../../state/core.selectors';
5-
import { filter, switchMap, take } from 'rxjs';
5+
import { filter, map, switchMap, take } from 'rxjs';
66

77
export class ComponentConfigHelper {
88

@@ -23,11 +23,16 @@ export class ComponentConfigHelper {
2323
filter(loadState => loadState === LoadingStateEnum.LOADED),
2424
take(1),
2525
switchMap(() => store$.select(selectComponentsConfigForType<ConfigType>(type)).pipe(take(1))),
26+
map((config): ConfigType => {
27+
const enabled = BaseComponentConfigHelper.isComponentEnabled(config ? [config] : [], type);
28+
if (config) {
29+
return { ...config.config, enabled };
30+
}
31+
return { enabled } as ConfigType;
32+
}),
2633
)
2734
.subscribe(config => {
28-
if (config) {
29-
callback(config.config);
30-
}
35+
callback(config);
3136
});
3237
}
3338

0 commit comments

Comments
 (0)