feat(install): improve photo pack installation logic to prevent immediate background refresh

This commit is contained in:
alexsparkes
2026-02-01 20:54:29 +00:00
parent 9f461edb55
commit 646f19a78c

View File

@@ -29,6 +29,7 @@ export function install(type, input, sideload, collection) {
case 'photos': {
const currentPhotos = JSON.parse(localStorage.getItem('photo_packs')) || [];
const hadPhotoPacks = currentPhotos.length > 0;
input.photos.forEach((photo) => {
currentPhotos.push(photo);
});
@@ -41,8 +42,11 @@ export function install(type, input, sideload, collection) {
localStorage.removeItem('backgroundchange');
// Clear image queue to ensure fresh background loads
clearQueuesOnSettingChange('packInstall');
// Set refresh event to emit after installed data is saved
refreshEvent = 'backgroundrefresh';
// Only refresh background if this is the first photo pack being installed
// Otherwise just update the queue without jarring the user with an immediate refresh
if (!hadPhotoPacks) {
refreshEvent = 'backgroundrefresh';
}
break;
}