Skip to content
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

removeWhere and initial conflict #2080

Open
fabienbranchel opened this issue Oct 30, 2024 · 0 comments
Open

removeWhere and initial conflict #2080

fabienbranchel opened this issue Oct 30, 2024 · 0 comments

Comments

@fabienbranchel
Copy link

I have this :

AutoRoute(
  page: FeatureIndex.page,
  path: 'feature-index',
  children: [
    AutoRoute(
      page: FeatureStep1.page,
      path: 'feature-step1',
      initial: true,
    ),
    AutoRoute(
      page: FeatureStep2.page,
      path: 'feature-step2',
    ),
  ],
)

I navigate to FeatureIndex, routing automatically to FeatureStep1 because it's initial route. Then, I navigate to FeatureStep2 from FeatureStep1.

On FeatureStep2, which is a StatefulWidget, I call setState to set a value.

From FeatureStep2, I navigate to FeatureIndex, routing automatically again on FeatureStep1 because it's initial route.

When I call context.router.removeWhere on FeatureStep2 to remove FeatureStep1 before navigate to FeatureIndex, there is these strange side effects :

  • dispose of FeatureStep2 is not called
  • FeatureStep2 is not removed from stack
  • when I navigate again to FeatureStep2 from FeatureStep1, the state is not reset

All these side effects don't exist when removeWhere is not called.

You can find a demo repo just here :
https://github.com/fabienbranchel/auto_route_remove_where_dispose

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

No branches or pull requests

1 participant