PullDating / FlutterApplication

The frontend flutter application, contains code for IOS, Android and web
GNU Affero General Public License v3.0
3 stars 1 forks source link

InitState is being called when going from the chats_tab to cards or profile tabs, resulting in excessive database calls. #51

Open WilliamDormer opened 2 years ago

WilliamDormer commented 2 years ago

Summary

When you try to navigate to the page, it loads as expected, but when you try to exit the page for the other slides, it runs the query again. This is wasteful since it requires database access and minio access.

Steps to reproduce

Run the Chats branch. Go to the chats tab, and then click on the cards tab on the bottom nav bar.

What is the expected correct behavior?

It should only run the get profile once, when it enters the page, not when it leaves as well.

Possible fixes

I saw that maybe it is because the navigation uses a transition from one widget to another, and the from widget is the reloaded version of the other tab, which is causing the query to execute again. Perhaps we need to find a way using the go router to make the from widget void in this case. https://www.appsloveworld.com/flutter/200/199/initstate-gets-called-when-navigating-to-a-new-page