mirror of
https://github.com/Dr-Blank/Vaani.git
synced 2025-12-18 00:49:30 +00:00
fix: optimize authenticatedApi provider to not rebuild unnecessarily
This commit is contained in:
parent
e21977b894
commit
69a7dc4b1d
2 changed files with 2 additions and 3 deletions
|
|
@ -49,8 +49,7 @@ AudiobookshelfApi audiobookshelfApi(Ref ref, Uri? baseUrl) {
|
||||||
/// if the user is not authenticated throw an error
|
/// if the user is not authenticated throw an error
|
||||||
@Riverpod(keepAlive: true)
|
@Riverpod(keepAlive: true)
|
||||||
AudiobookshelfApi authenticatedApi(Ref ref) {
|
AudiobookshelfApi authenticatedApi(Ref ref) {
|
||||||
final apiSettings = ref.watch(apiSettingsProvider);
|
final user = ref.watch(apiSettingsProvider.select((s) => s.activeUser));
|
||||||
final user = apiSettings.activeUser;
|
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
_logger.severe('No active user can not provide authenticated api');
|
_logger.severe('No active user can not provide authenticated api');
|
||||||
throw StateError('No active user');
|
throw StateError('No active user');
|
||||||
|
|
|
||||||
|
|
@ -170,7 +170,7 @@ class _AudiobookshelfApiProviderElement
|
||||||
Uri? get baseUrl => (origin as AudiobookshelfApiProvider).baseUrl;
|
Uri? get baseUrl => (origin as AudiobookshelfApiProvider).baseUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
String _$authenticatedApiHash() => r'5cf3329fe3074e3a09e266b4bae78b53e9c01220';
|
String _$authenticatedApiHash() => r'284be2c39823c20fb70035a136c430862c28fa27';
|
||||||
|
|
||||||
/// get the api instance for the authenticated user
|
/// get the api instance for the authenticated user
|
||||||
///
|
///
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue