Skip to content

Conversation

@wamynobe
Copy link

@wamynobe wamynobe commented Jan 19, 2024

fix #1238 #1278

@wamynobe
Copy link
Author

@Milad-Akarie Can you take a look on this please?

@Shreemanarjun
Copy link

@Milad-Akarie I think this should be a good feature to add.

@Milad-Akarie
Copy link
Owner

@Shreemanarjun its planned, it's more complicated than it seems

@cavin-7span
Copy link

@Milad-Akarie Are you going to work on this?

@wamynobe
Copy link
Author

Hi @Milad-Akarie , are you going to work on this? If not, please provide us more information about the context, and how it seems to be more complicated so that we can keep working on. Thanks in advance!

@juliankeppeler-zero
Copy link

Any updates on this?

Comment on lines +682 to +685
final guards = <AutoRouteGuard>[
if (_rootGuard != null) _rootGuard!,
...route.guards,
];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main porblem with reusing existing guards, is that it might cause side effects. I tried to fix this in my fork and faced the same challenged.

Consider the following:

  • you have a page and this page has three tabs
  • these tabs are using the same guard used on the root router
  • within the root you have a a custom guard that auto redirects to another page.

with the code you're proposing, if you open the page with that same tab, your expected behavior is tfor auto_route to simply prevent navigating to that tab where its guard has result.continueNavigation set to false. Instead, your code will also trigger the redirect, breaking the flow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for guarding routes in AutoTabsScaffold

6 participants