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

2897: Refresh cities every day #2921

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

steffenkleinle
Copy link
Member

@steffenkleinle steffenkleinle commented Sep 11, 2024

Short description

At the moment, cities are not refreshed at all anymore if a city has been selected.
In Landing, we call the refresh manually as a workaround.
However, if a city is selected, Landing is not rendered anymore and therefore the workaround is not triggered.

This PR works around that by using useLoadWithCache instead of useLoadCities in the useCityContent hook.

Proposed changes

Use useLoadWithCache over useLoadCities in the useCityContent hook.

Side effects

None.

Testing

Instead of manually changing values in the CMS and waiting for the next day for the refresh to happen, you can also do the following:

eventsEnabled: true
const shouldUpdate = forceUpdate || !lastUpdate || lastUpdate < DateTime.utc().startOf('day').plus({ day: 1 })

Resolved issues

Fixes: #2897.


Copy link

codeclimate bot commented Sep 11, 2024

Code Climate has analyzed commit 0f2898a and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 0.0% (50% is the threshold).

This pull request will bring the total coverage in the repository to 74.2%.

View more on Code Climate.

@steffenkleinle steffenkleinle marked this pull request as ready for review September 12, 2024 09:05
Copy link
Contributor

@LeandraH LeandraH left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm, I deactivated events in the CMS and set shouldUpdate = true in useLoadWithCache; I then tapped around in the app a little, in the hopes that that would trigger a refresh but only an actual pull-to-refresh did. Any ideas?

Simulator.Screen.Recording.-.iPhone.15.-.2024-09-17.at.11.21.05.mp4

Copy link
Contributor

@LeandraH LeandraH left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it does work when the app is restarted (i.e. removed from the RAM and opened again), which seems to be the case that didn't work here :)

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

Successfully merging this pull request may close these issues.

Background app refresh not happening
2 participants