add redundant readdir to cache the home dir

This commit is contained in:
jelveh
2025-09-18 21:03:28 -07:00
parent 7000831138
commit c0b03e147b
2 changed files with 8 additions and 7 deletions
+3 -7
View File
@@ -56,19 +56,15 @@ const whoami_common = ({ is_user, user }) => {
}
if(user.last_activity_ts){
let dateString = user.last_activity_ts;
// Replace the space with 'T' to make it ISO 8601 compliant
const isoString = dateString.replace(' ', 'T');
// Create a Date object and get the epoch timestamp
let epoch;
try{
epoch = new Date(isoString).getTime() / 1000;
epoch = new Date(user.last_activity_ts).getTime();
// round to 1 decimal place
epoch = Math.round(epoch);
epoch = Math.round(epoch/1000);
}catch(e){
console.error('Error parsing last_activity_ts', e);
// console.error('Error parsing last_activity_ts', e);
}
// add last_activity_ts
+5
View File
@@ -1056,6 +1056,11 @@ async function UIDesktop(options) {
}
})
// perform readdirs for caching purposes
// home directory
puter.fs.readdir({path: window.home_path, consistency: 'strong'});
// Show welcome window if user hasn't already seen it and hasn't directly navigated to an app
if (!window.url_paths[0]?.toLocaleLowerCase() === 'app' || !window.url_paths[1]) {
if (!isMobile.phone && !isMobile.tablet) {