Skip to content

Commit 99a57d5

Browse files
fix(user): update user if input data is changed (#553)
* fix(user): update user if input data is changed this fixes the bug, that vCard or bookmarks are not update if the user is changed directly * Update Phonebook.Frontend/src/app/shared/components/user/user-detail/user-detail.component.ts
1 parent 0b0ec3d commit 99a57d5

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Phonebook.Frontend/src/app/shared/components/user/user-detail/user-detail.component.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, HostListener, Input, OnDestroy, OnInit } from '@angular/core';
1+
import { Component, HostListener, Input, OnDestroy, OnInit, OnChanges } from '@angular/core';
22
import { MatSnackBar } from '@angular/material/snack-bar';
33

44
import { Select, Store } from '@ngxs/store';
@@ -22,7 +22,7 @@ export interface IncorrectUserInformationDialogData {
2222
templateUrl: './user-detail.component.html',
2323
styleUrls: ['./user-detail.component.scss']
2424
})
25-
export class UserDetailComponent implements OnInit, OnDestroy {
25+
export class UserDetailComponent implements OnInit, OnChanges, OnDestroy {
2626
@Input()
2727
public person: Person;
2828
public bookmarked: Bookmarked = Bookmarked.isNotBookmarked;
@@ -49,7 +49,9 @@ export class UserDetailComponent implements OnInit, OnDestroy {
4949
private dialog: MatDialog
5050
) { }
5151

52-
public ngOnInit() {
52+
public ngOnInit() {}
53+
54+
public ngOnChanges(): void {
5355
this.rocketChatLink = this.getRocketChatLink();
5456
this.bookmarks$.pipe(untilComponentDestroyed(this)).subscribe(bookmarks => {
5557
const index = bookmarks.findIndex(p => p.Id === this.person.Id);

0 commit comments

Comments
 (0)