akveo / akveo/nebular

Memory leak of accessChecker.isGranted ??

Ouverte
#3,027 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
TypeScript
Étoiles
8.1k
Forks
1.5k
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

Version 9

I'm using this to display a button depending on user roles :
```

```

It is calling this method :

```
@Injectable()
export class NbSimpleRoleProvider extends NbRoleProvider {

getRole(): Observable {
return this.authService.onTokenChange()
.pipe(
map((token: NbAuthJWTToken) => {
console.log('Ton role est : ' + token.getPayload().roles[0].authority); // Calling so much time this !
return token.isValid() ? token.getPayload().roles[0].authority : 'GUEST';
}),
);
}
..
..
..
}
```

The problem is that the page is calling so many times "accessChecker.isGranted" ! For each row of my table it calls the accessChecker, and if i keep the mouse on the button without doing anything else, it keep calling "accessChecker.isGranted" !
So thousand of calls in few seconds..
![memory_leak](https://user-images.githubusercontent.com/30440458/153761798-921dd809-4c9a-481e-8bcb-8bec287aff5d.gif)

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.