Searching/displaying contacts workaround unstable

We are using the device contacts component to let users send invitations to their contacts.

We found that if a user had lots of contacts on their phone (I have almost 800), it would take a long time for the view to load (about 20 seconds for me). To correct for that, we configured it to load only so many contacts at a time with a search bar that would re-populate the list based on a contact’s first or last name.

Unfortunately, that isn’t working consistently. It works just fine on my Android, but for many Android users, the list does not re-populate when they click the search icon.

I suspect this may be a vulnerability for low-performance phones (which we were able to design around for another bug).

I would love to hear if the AppGyver team has any thoughts on how else we could configure this to deliver a fast, stable device contacts experience.

App: 98690
Page: Invite to group

Page load logic:

Slice contacts code:

Search logic (on cell):

Paginate code:

It’s a good idea to limit the number of components that are shown. Rendering is the bottleneck, and it quickly becomes very slow once you start hitting hundreds or thousands of components. We’ll have major improvements for this in the next major runtime release, but that’s not yet quite ready.

At a glance your setup seems good, and clearly it’s functional if it works on your device. My initial thoughts go to two possibilities:

  1. The cell tap event is not actually being run. Layouting on Android has been problematic at times with all the different models and versions around. If the cell dimensions were somehow squished to zero on a device, the user couldn’t trigger the tap event.

  2. Changes in the rendered variable (assuming contactView) are not detected correctly on some devices. This would be easiest to test and potentially workaround by first emptying the list, which should trigger a re-render. And after that running your pagination code and setting the correct contents, which should trigger another re-render.

The second possibility is more likely, but the first one is worth verifying as well.

Sorry to hear that things are not working properly out-of-the-box with all the Android devices you’ve tested. If you know of specific Android models that reproduce this issue consistently, we’d love to know.

Thank you for that helpful input! My gut tells me the tap event isn’t being run. I’ll think of how to redesign the page in light of all the info you shared. I really appreciate you taking the time to educate me @Pekka_Aaltonen!

Hey friends!

I’m back to working on this feature redesign and could use a bit of guidance.

Recap
The page listing the phone contacts has so many components that the flow to search contacts doesn’t always render, and thus doesn’t always work.

Redesign
Now, a button that says “Search phone contacts” links to a separate page where users input their search. When they click to search, it populates the deviceContactsSearchText app variable that is then taken into account when they’re sent back to the contacts page and it recalculates its list of contacts.

Problem
It appears that the page isn’t triggering its page load/focus flow that would cause it to recalculate which contacts to display. I suspect this is the case because the flow that shows up in the debugger when the page loads the first time does not show up in the debugger when navigating to the page again.

Note that the button to get back to the contacts page uses the “open page” node and not a “navigate back” node.

Question
How can I force the contact list page to load as though it were loading for the first time? I suspect this is related to the navigation stack (a concept I apparently don’t grasp as well as I thought I did).

Some helpful visuals
List of contacts page (and option to go to the search page)

Flow logic on list of contacts page
image
Within Flow function 2*


Slice page javascript

Search contacts page


Logic on the search button

I tried with my own app and it seems that the events (mounted and focused) do actually trigger. I tried this by adding a toast to them and checking if it appears when I open the page again. You could give it a similar test and then would possibly know to look for the issue elsewhere.

One thing to note is that as you’re opening the page again and not navigating back, it’s in totally new context. So if there was something done within context of the initial Contacts page, it won’t show in the context of the new Contacts page.

I will play around with that. I strongly suspect that I will be back with more questions, but thank you for these next steps @Tomi_Laakso!