mirror of
https://github.com/HeyPuter/puter.git
synced 2026-08-26 16:07:13 +00:00
fix: refresh Home "Recently used" apps instead of freezing them for the session
loadRecentApps only hit /get-launch-apps when window.launch_apps.recent was empty. Once populated (typically at page load), every subsequent init/onActivate /focus just re-rendered the same cached array, so apps launched during the session never showed up under "Recently used" until a hard reload. Drop the empty-list guard so the list refetches on the same triggers that already refresh the usage cards. The fetch can only make the list fresher.
This commit is contained in:
@@ -306,20 +306,21 @@ const TabHome = {
|
||||
},
|
||||
|
||||
async loadRecentApps($el_window) {
|
||||
if (!window.launch_apps?.recent?.length) {
|
||||
try {
|
||||
window.launch_apps = await $.ajax({
|
||||
url: `${window.api_origin}/get-launch-apps?icon_size=64`,
|
||||
type: 'GET',
|
||||
async: true,
|
||||
contentType: 'application/json',
|
||||
headers: {
|
||||
Authorization: `Bearer ${window.auth_token}`,
|
||||
},
|
||||
});
|
||||
} catch (e) {
|
||||
console.error('Failed to load launch apps:', e);
|
||||
}
|
||||
// Always refetch: gating on an empty list froze "Recently used" for the
|
||||
// whole session (apps launched after load never appeared). loadUsageData
|
||||
// refreshes on the same activate/focus triggers, so this stays in step.
|
||||
try {
|
||||
window.launch_apps = await $.ajax({
|
||||
url: `${window.api_origin}/get-launch-apps?icon_size=64`,
|
||||
type: 'GET',
|
||||
async: true,
|
||||
contentType: 'application/json',
|
||||
headers: {
|
||||
Authorization: `Bearer ${window.auth_token}`,
|
||||
},
|
||||
});
|
||||
} catch (e) {
|
||||
console.error('Failed to load launch apps:', e);
|
||||
}
|
||||
$el_window
|
||||
.find('.bento-recent-apps-container')
|
||||
|
||||
Reference in New Issue
Block a user