Fixes for PostHog

This commit is contained in:
Arseni
2025-12-11 17:41:25 +03:00
parent 97f71d125e
commit 83e3af9a42
18 changed files with 276 additions and 39 deletions

View File

@@ -21,6 +21,7 @@ class PermissionsProvider extends ChangeNotifier {
Resource<UserAccess> _userAccess = Resource(data: null, isLoading: false, error: null);
late OrganizationsProvider _organizations;
bool _isLoaded = false;
bool _errorHandled = false;
void update(OrganizationsProvider venue) {
_organizations = venue;
@@ -44,6 +45,7 @@ class PermissionsProvider extends ChangeNotifier {
/// Load the [UserAccess] for the current venue.
Future<UserAccess?> load() async {
_userAccess = _userAccess.copyWith(isLoading: true, error: null);
_errorHandled = false;
notifyListeners();
try {
@@ -67,6 +69,12 @@ class PermissionsProvider extends ChangeNotifier {
return _userAccess.data;
}
bool get hasUnhandledError => error != null && !_errorHandled;
void markErrorHandled() {
_errorHandled = true;
}
Future<UserAccess?> changeRole(String accountRef, String newRoleDescRef) async {
final currentRole = roles.firstWhereOrNull((r) => r.accountRef == accountRef);
final currentDesc = currentRole != null