Page mounted and page focused / ¿BUG OR MISUSE?

Hi guys,

This time I have a big doubt with this two events type.

In this case, I have the next flow function connected to the backend in the HOME Page Layout:

What this flow function means?:

This mean if some APP’s Vars, are empty, then I check my database variable to find some information and show it. (I stored the information in app vars and store it there because I don’t want to check my database everytime I go to HomePage)

This is one example of the 9 querys I have:

STRING(REPLACE_ALL(FORMAT_LOCALIZED_DECIMAL(SUM(MAP(SELECT(data.new_shipments1, item.fields.shipment_status.stringValue !== "Entregado" && item.fields.email_creator.stringValue == appVars.Successlogin.email && FORMAT_DATETIME_LOCAL(item.createTime, "MMMM") == FORMAT_DATETIME_LOCAL(NOW(), "MMMM")),NUMBER(item.fields.shipment_fee.integerValue))),"en",0,0),",","."))

Note: I just have 11 documents on that collection and now I have 4.6K reads, just login 1 time.

The problem is when I login and automatically go to the Home page, firebase keeps counting reads without stop, feels like I keep querying the database meanwhile I’m in the homepage doing NOTHING.

The event “Page Mounted” means “we do this meanwhile the page is mounted” or it does just one time?

What’s the difference between “Page mounted” and “Page focused” ?

Thanks in advance.

Finnaly I discovered there is an automatic configured loop when you make a “GET” query to the backend with the appgyver function.

I think this works for those that one keep always the info updated, but I just want to be updated when somebody trigger it through “pull to refresh”.

So this is how I solve my problem, “deleting the delay” function.

Thanks for those who readed this post trying to help.

What’s the difference between “Page mounted” and “Page focused” ?. I have the same doubt

Page mounted is the first time the page is created. That is usually when the user visits the page for the first time after the app has been launched.

Page focused event is triggered on all occasions when the page is placed in focus. So for example a user taps a button that opens the camera and then closes that, after closing the camera flow the page focused will be triggered again.

Think of these as page mounted to have logic that should execute once in an app’s lifecycle, and focused on any occasion the page is shown to the user.

1 Like