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

gallery seems slow to load and displays conflicting data #588

Open
krugerk opened this issue Dec 30, 2024 · 5 comments
Open

gallery seems slow to load and displays conflicting data #588

krugerk opened this issue Dec 30, 2024 · 5 comments
Labels
BUG Opposite of feature

Comments

@krugerk
Copy link
Contributor

krugerk commented Dec 30, 2024

The "last updated" label on the gallery often shows a more recent relative time than the goals listed underneath it in that same moment. Then, some while later, while the label still shows the same "last updated", the set of goals are refreshed, showing their more up-to-date states.

From the sign in screen:
fill out username and password, tap the Sign In button
Time 0

The Sign In screen is still shown but now with a disabled Sign In Button and with an activity indicator.

Time 1.1s
the sign in screen starts sliding out of view to reveal the gallery

Gallery's last updated is shown and it shows 57 seconds ago

The gallery appears otherwise empty (no goals shown and no message about not having any goals). The activity indicator is shown.

Time 1.6s
Gallery now reports last updated now and shows the message for not having any goals. The activity indicator is still shown. This account has goals.

Time 4.5s
Gallery no longer shows the activity indicator, the goals are now shown all at once, the last updated still (or again?) shows now

The gallery could have a better (initial) loading state. Let this be a separate topic.

There appears to be some lag between when the gallery shows "last updated now" and when the contents of the collection view show the goals in their "now" state. This discrepancy is something new that came about with the integration of goals in core data (6.7 (51)).

Once the user has signed in, the app would have received the list of goal names for non-archived, non-deleted goals. The app triggers a signedInNotification which the Gallery receives. It triggers its fetchGoals which in turn has the GoalManager fetch from the goals endpoint, persisting the data locally in core data.
It seems to me that at least initially all of the last updated + list of goals + activity indicator should all update in the same moment.

@krugerk krugerk added the BUG Opposite of feature label Dec 30, 2024
@theospears
Copy link
Collaborator

I've also noticed this. I've been unable to obviously see the cause from looking through the code.

@krugerk
Copy link
Contributor Author

krugerk commented Jan 8, 2025

It seems particularly noticeable when bringing the app into the foreground after a while in the background when the signed in account has HealthKit linked goals. The gallery shows goal cells and it can be scrolled but the scrolling is laggy or choppy.

theospears pushed a commit that referenced this issue Jan 14, 2025
## Summary
The initial loading (displaying) of goals on the gallery was slow. The
app was still relying on passing and receiving
nsnotification/notifications.
With the data in Core Data, the NSFetchedResultsController can be used.

Migrated galleryVC to use the fetched results controller.
Updated the sorting implementation accordingly, directly applying the
sort type to the fetchRequest itself.
Updated the filtering as well to also apply directly to the
fetchRequest.


## Validation
Ran the app in the simulator.
Changed sorting.
Changed filters.
Signed in.
Signed out.
Navigated from Gallery to Goal and back.
Sent app into background. Brought back into foreground.
Force quit app, relaunched app.


## Tickets
helps with #588
@krugerk
Copy link
Contributor Author

krugerk commented Jan 14, 2025

In the simulator this issue seemed no longer present with changes from #607. Once a build with the changes is available for hardware (a build in TestFlight), the situation will be checked again. Perhaps those changes fixed this issue altogether.

theospears pushed a commit that referenced this issue Jan 27, 2025
## Summary
Gallery was not updating how its list was sorted after the preference
had been adjusted. Also, the gallery's last updated was meant to display
when the goals were last fetched.


### 
The gallery was not monitoring for changes to the sorting preference. It
needed a trigger to sort the list anew. This was removed in
d181dba. 'Update goals' can stay, it is the fetch goals that
was to be reduced. Furthermore, since gallery's last updated is meant to
indicate how fresh the data is (when they were last fetched), gallery's
setting this to now where it did does not necessarily coincide with
fetching the goals anew. Instead, the goal manager already provides this
nugget.


*For UI changes including screenshots of before and after is great.*

## Validation
Ran app in simulator. 
gallery -> settings -> sort pref, picked another, and back to gallery
from settings
Noticed sort had taken effect.
Also noticed last updated seems much more up-to-date and less out of
sync, as reported in #588.
@krugerk
Copy link
Contributor Author

krugerk commented Feb 23, 2025

A user on the forum reported what appears to be the same behavior: https://forum.beeminder.com/t/ios-ux-comments/12243/3. The user also pointed out that

If the fetch errors for any reason, the last updated banner can still read ‘now’ even for very stale graph data.

@krugerk
Copy link
Contributor Author

krugerk commented Mar 10, 2025

Most of what this ticket describes has been addressed, is no longer reproducible, with the recent version available in TestFlight: 6.8 (62).
I have not looked specifically at the aforementioned mentioned issue of what is shown when a fetch error occurs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BUG Opposite of feature
Projects
None yet
Development

No branches or pull requests

2 participants