Skip to content

Commit

Permalink
feat: Delay icon's caching manager 30s after startup
Browse files Browse the repository at this point in the history
Icons caching may slow down the startup process but is not necessary
for the app to work

If not called in time, this would only impact cozy-apps opening
animation that will use generic icons (if never called before) or
potentially old icons (in the rare cases when we update a cozy-app
icon)

So we chose to delay this call a short delay after the startup (for now
30s)
  • Loading branch information
Ldoppea committed Dec 20, 2024
1 parent 4d7d6b4 commit 9ca8720
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/hooks/useAppBootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import { useHomeStateContext } from '/screens/home/HomeStateProvider'

const log = Minilog('useAppBootstrap')

const MANAGE_ICON_CACHE_DELAY_IN_MS = 30 * 1000

export const useAppBootstrap = client => {
const [markName] = useState(() => rnperformance.mark('useAppBootstrap'))
const [initialRoute, setInitialRoute] = useState('fetching')
Expand Down Expand Up @@ -176,7 +178,8 @@ export const useAppBootstrap = client => {
return
}

client && manageIconCache(client)
client &&
setTimeout(() => manageIconCache(client), MANAGE_ICON_CACHE_DELAY_IN_MS)
client && setSentryTag(SentryCustomTags.Instance, client.stackClient?.uri)

const subscription = Linking.addEventListener('url', ({ url }) => {
Expand Down

0 comments on commit 9ca8720

Please sign in to comment.