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

[compass_app] Unnecessary screen rebuild on navigation #2574

Open
tsantos84 opened this issue Feb 4, 2025 · 2 comments
Open

[compass_app] Unnecessary screen rebuild on navigation #2574

tsantos84 opened this issue Feb 4, 2025 · 2 comments

Comments

@tsantos84
Copy link

I've cloned the compass_app project to investigate a behavior I'm also encountering in my own application. Surprisingly, compass_app exhibits the same issue: when navigating between screens, the previous screen is rebuilt, triggering its data fetching logic and resulting in an unnecessary backend call.

Here's how to reproduce the behavior:

  1. Start the application in development mode.
  2. Clear the app logs for easier analysis.
  3. From the HomeScreen, tap the first activity. This will navigate to the ActivitiesScreen.
  4. Examine the logs. You'll see the HomeViewModel logs reappear, indicating that the _load method has been called again.
@tsantos84 tsantos84 changed the title Unnecessary screen rebuild on navigation [compass_app] Unnecessary screen rebuild on navigation Feb 4, 2025
@tsantos84
Copy link
Author

It appears that this issue might be related to the go_router package. There are several open issues in the Flutter repository that seem to be related:

#158934
#147639
#141281

While I’m not entirely sure if these issues are directly related to this specific problem, they might provide some useful context or overlap. It would be great to investigate further to determine if this is a known issue or a new edge case.

@lancelot-koh
Copy link

do we have any workaround/suggestion to prevent re-fetch data when page is loading if possible? thks

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

2 participants