-
Notifications
You must be signed in to change notification settings - Fork 6
Big revamp: Auth/Repository/Router #561
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #561 +/- ##
==========================================
+ Coverage 54.29% 55.86% +1.56%
==========================================
Files 169 170 +1
Lines 3702 3693 -9
==========================================
+ Hits 2010 2063 +53
+ Misses 1692 1630 -62 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
e44641b to
53cc974
Compare
53cc974 to
c46e204
Compare
4c8b9d3 to
3606c7b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements a major refactor of the authentication, repository, and routing logic in the administration module by removing the usage of the tokenExpireWrapper, updating repository constructors to accept the provider reference, and cleaning up unused imports.
- Removed tokenExpireWrapper calls from multiple UI pages to simplify asynchronous workflows.
- Updated repository instantiations to use dependency injection via constructor parameters.
- Removed outdated token management imports that are no longer needed.
Reviewed Changes
Copilot reviewed 261 out of 261 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| lib/admin/ui/pages/memberships/association_membership_detail_page/association_membership_information_editor.dart | Removed tokenExpireWrapper call from updateAssociationMembership process. |
| lib/admin/ui/pages/memberships/add_edit_user_membership_page/add_edit_user_membership_page.dart | Removed tokenExpireWrapper wrapping for user queries and group updates. |
| lib/admin/ui/pages/groups/group_page/group_page.dart | Removed tokenExpireWrapper call from group deletion confirmation. |
| lib/admin/ui/pages/groups/edit_group_page/search_user.dart | Removed tokenExpireWrapper in the remove group member callback. |
| lib/admin/ui/pages/groups/edit_group_page/edit_group_page.dart | Removed tokenExpireWrapper call from group update process. |
| lib/admin/ui/pages/groups/add_loaner_page/add_loaner_page.dart | Removed tokenExpireWrapper call in the onTap callback for adding loaners. |
| lib/admin/ui/pages/groups/add_group_page/add_group_page.dart | Removed tokenExpireWrapper call during group creation. |
| lib/admin/ui/pages/add_edit_structure_page/add_edit_structure_page.dart | Removed tokenExpireWrapper call during structure update/creation. |
| lib/admin/ui/admin.dart | Removed tokenExpireWrapper call from the onMenu callback in the top bar. |
| (Various repository and provider files) | Updated repository constructors to accept ref and set tokens, and removed obsolete tokenExpireWrapper imports. |
Comments suppressed due to low confidence (2)
lib/admin/ui/pages/memberships/association_membership_detail_page/association_membership_information_editor.dart:123
- Ensure that token expiration handling is appropriately maintained after removing the tokenExpireWrapper call in the update flow. If a new pattern is being adopted, verify that it covers all necessary error and token refresh scenarios.
await tokenExpireWrapper(ref, () async {
lib/admin/ui/pages/memberships/add_edit_user_membership_page/add_edit_user_membership_page.dart:61
- Review the removal of tokenExpireWrapper in the asynchronous onChanged and group update callbacks to ensure that token expiration and error handling is still effectively managed by the new approach.
tokenExpireWrapper(ref, () async {
ee0ffbe to
8e86bc5
Compare
lib/login/ui/app_sign_in.dart
Outdated
| final forwardedFrom = | ||
| QR.params[forwardedFromKey]?.toString() ?? AppRouter.root; | ||
| final redirectPath = ref.watch( | ||
| authRedirectServiceProvider.select( | ||
| (service) => service.getRedirect(forwardedFrom), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The service should take QR.currentPath instead
| final forwardedFrom = | |
| QR.params[forwardedFromKey]?.toString() ?? AppRouter.root; | |
| final redirectPath = ref.watch( | |
| authRedirectServiceProvider.select( | |
| (service) => service.getRedirect(forwardedFrom), | |
| final redirectPath = ref.watch( | |
| authRedirectServiceProvider.select( | |
| (service) => service.getRedirect(QR.currentPath), |
| QR.to(pathForwarding.path); | ||
| QR.to( | ||
| QR.params['forwardedFrom'] | ||
| ?.toString() ?? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the redirect service and do not access 'forwardedFrom' directly
| final forwardedFrom = | ||
| QR.params[forwardedFromKey]?.toString() ?? AppRouter.root; | ||
|
|
||
| final redirectPath = ref.watch( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check that
|
|
||
| if (redirectPath != null && | ||
| Uri.parse(redirectPath).path != AppRouter.loading) { | ||
| Future.microtask(() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check that
lib/routing/ui/no_module.dart
Outdated
| QR.params[forwardedFromKey]?.toString() ?? AppRouter.root; | ||
| final redirectPath = ref.watch( | ||
| authRedirectServiceProvider.select( | ||
| (service) => service.getRedirect(forwardedFrom), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
| TypeMsg.msg, | ||
| SeedLibraryTextConstants.addedSpecies, | ||
| SeedLibraryTextConstants.updatedSpecies, | ||
| ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not touch that
|
|
||
| void removeQueryParam(String keyToRemove) { | ||
| final params = QR.params.asMap; | ||
| params.remove(keyToRemove); | ||
| QR.params.updateParams(QParams(params: params)); | ||
| } | ||
|
|
||
| void addQueryParam(String key, String value) { | ||
| final params = QR.params.asMap; | ||
| params[key] = ParamValue(value, keepAlive: true); | ||
| QR.params.updateParams(QParams(params: params)); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be cleaned up
| setTData(t, AsyncData([value])); | ||
| } | ||
| }); | ||
| loader(t).then((value) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably what caused the bug with autoloader (fixed)
| loader == null | ||
| ? notifier.autoLoadList(ref, mapKey, listLoader!) | ||
| : notifier.autoLoad(ref, mapKey, loader!); | ||
| Future( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix a bug
…d not the current page
… token expiration
f69587a to
f7111d1
Compare
…ion during refresh
Full refacto of app routing