@@ -475,9 +475,6 @@ async function displayUserList(listType, userEmail) {
475
475
const listRef = collection ( db , 'profiles' , userEmail , listType ) ;
476
476
const userListSpan = document . getElementById ( `${ listType } List` ) ;
477
477
478
- const CACHE_KEY = `movieVerseUserListCache_${ listType } _${ userEmail } ` ;
479
- const CACHE_EXPIRATION_MS = 24 * 60 * 60 * 1000 ; // 24 hours
480
-
481
478
let loadingInterval ;
482
479
function startLoadingAnimation ( ) {
483
480
let dots = '' ;
@@ -492,46 +489,6 @@ async function displayUserList(listType, userEmail) {
492
489
userListSpan . innerHTML = '' ;
493
490
}
494
491
495
- function loadFromCache ( ) {
496
- const cachedData = localStorage . getItem ( CACHE_KEY ) ;
497
- if ( cachedData ) {
498
- const parsedCache = JSON . parse ( cachedData ) ;
499
- if ( Date . now ( ) - parsedCache . timestamp < CACHE_EXPIRATION_MS ) {
500
- return parsedCache . data ;
501
- }
502
- }
503
- return null ;
504
- }
505
-
506
- function saveToCache ( data ) {
507
- const cacheEntry = {
508
- data : data ,
509
- timestamp : Date . now ( ) ,
510
- } ;
511
- localStorage . setItem ( CACHE_KEY , JSON . stringify ( cacheEntry ) ) ;
512
- }
513
-
514
- const cachedData = loadFromCache ( ) ;
515
- if ( cachedData ) {
516
- userListSpan . innerHTML = '' ;
517
- cachedData . forEach ( userData => {
518
- const userLink = document . createElement ( 'a' ) ;
519
- userLink . textContent = userData . username ;
520
- userLink . href = '#' ;
521
- userLink . id = 'userLink' ;
522
- userLink . style . cursor = 'pointer' ;
523
- userLink . onclick = ( ) => loadProfile ( userData . id ) ;
524
-
525
- userListSpan . appendChild ( userLink ) ;
526
- userListSpan . appendChild ( document . createTextNode ( ', ' ) ) ;
527
- } ) ;
528
-
529
- if ( userListSpan . lastChild ) {
530
- userListSpan . removeChild ( userListSpan . lastChild ) ;
531
- }
532
- return ;
533
- }
534
-
535
492
startLoadingAnimation ( ) ;
536
493
537
494
try {
@@ -541,14 +498,11 @@ async function displayUserList(listType, userEmail) {
541
498
if ( snapshot . empty ) {
542
499
userListSpan . textContent = 'N/A' ;
543
500
} else {
544
- const fetchedData = [ ] ;
545
-
546
501
for ( let docSnapshot of snapshot . docs ) {
547
502
const userRef = doc ( db , 'profiles' , docSnapshot . id ) ;
548
503
const userSnap = await getDoc ( userRef ) ;
549
504
if ( userSnap . exists ( ) ) {
550
505
const userData = userSnap . data ( ) ;
551
- fetchedData . push ( { id : docSnapshot . id , username : userData . username } ) ;
552
506
553
507
const userLink = document . createElement ( 'a' ) ;
554
508
userLink . textContent = userData . username ;
@@ -565,8 +519,6 @@ async function displayUserList(listType, userEmail) {
565
519
if ( userListSpan . lastChild ) {
566
520
userListSpan . removeChild ( userListSpan . lastChild ) ;
567
521
}
568
-
569
- saveToCache ( fetchedData ) ;
570
522
}
571
523
} catch ( error ) {
572
524
console . error ( 'Error fetching user list:' , error ) ;
@@ -608,6 +560,7 @@ async function saveProfileChanges() {
608
560
favoriteActor : document . getElementById ( 'editFavoriteActor' ) . value ,
609
561
favoriteDirector : document . getElementById ( 'editFavoriteDirector' ) . value ,
610
562
personalQuote : document . getElementById ( 'editPersonalQuote' ) . value ,
563
+ profileImage : currentProfile ?. profileImage || '' ,
611
564
} ;
612
565
613
566
try {
0 commit comments