fix: optimize authenticatedApi provider to not rebuild unnecessarily

This commit is contained in:
Dr.Blank 2025-04-19 14:49:12 +05:30
parent e21977b894
commit 69a7dc4b1d
No known key found for this signature in database
GPG key ID: BA5F87FF0560C57B
2 changed files with 2 additions and 3 deletions

View file

@ -49,8 +49,7 @@ AudiobookshelfApi audiobookshelfApi(Ref ref, Uri? baseUrl) {
/// if the user is not authenticated throw an error
@Riverpod(keepAlive: true)
AudiobookshelfApi authenticatedApi(Ref ref) {
final apiSettings = ref.watch(apiSettingsProvider);
final user = apiSettings.activeUser;
final user = ref.watch(apiSettingsProvider.select((s) => s.activeUser));
if (user == null) {
_logger.severe('No active user can not provide authenticated api');
throw StateError('No active user');