Skip to content

Commit 934ca8f

Browse files
Copilotrenemadsen
andcommitted
Initialize isAdmin and isFirstUser at declaration to fix empty debug box
- Changed initialization from ngOnInit() to property declaration - Set isAdmin = true and isFirstUser = true at declaration time - This ensures values are available immediately when template renders - Fixes issue where yellow debug box was empty (no interpolated values) - Template binding happens before ngOnInit(), so values must be set at declaration Co-authored-by: renemadsen <[email protected]>
1 parent ee73046 commit 934ca8f

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

eform-client/src/app/plugins/modules/time-planning-pn/components/plannings/time-planning-actions/assigned-site/assigned-site-dialog.component.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@ export class AssignedSiteDialogComponent implements DoCheck, OnInit, OnDestroy {
3636

3737
public selectCurrentUserIsAdmin$ = this.store.select(selectCurrentUserIsAdmin);
3838
public selectCurrentUserIsFirstUser$ = this.store.select(selectCurrentUserIsFirstUser);
39-
public isAdmin: boolean = false;
40-
public isFirstUser: boolean = false;
39+
// Initialize to true for testing - set immediately so template can access
40+
public isAdmin: boolean = true;
41+
public isFirstUser: boolean = true;
4142
private previousData: AssignedSiteModel;
4243
private globalAutoBreakSettings: GlobalAutoBreakSettingsModel;
4344
private destroy$ = new Subject<void>();
@@ -56,9 +57,7 @@ export class AssignedSiteDialogComponent implements DoCheck, OnInit, OnDestroy {
5657
// this.calculateHours();
5758

5859
// Subscribe to observables to get boolean values for child components
59-
// Temporarily set to true for testing the refactor
60-
this.isAdmin = true;
61-
this.isFirstUser = true;
60+
// NOTE: isAdmin and isFirstUser already initialized to true at declaration for testing
6261

6362
// TODO: Uncomment after establishing refactor works
6463
// this.selectCurrentUserIsAdmin$.pipe(takeUntil(this.destroy$)).subscribe(isAdmin => {

0 commit comments

Comments
 (0)