mirror of
https://github.com/fallenbagel/jellyseerr.git
synced 2025-12-23 18:29:19 -05:00
fix(UserProfile): handle optional chaining for recentlyWatched data (#1852)
This PR fixes a client-side TypeError in the "Recently Watched" section of user profiles. The issue occurred when recentlyWatched was undefined. The fix adds optional chaining (?.) to prevent the app from crashing. Signed-off-by: 0xsysr3ll <0xsysr3ll@pm.me>
This commit is contained in:
@@ -378,7 +378,7 @@ const UserProfile = () => {
|
||||
{user.userType === UserType.PLEX &&
|
||||
(user.id === currentUser?.id ||
|
||||
currentHasPermission(Permission.ADMIN)) &&
|
||||
(!watchData || !!watchData.recentlyWatched.length) &&
|
||||
(!watchData || !!watchData.recentlyWatched?.length) &&
|
||||
!watchDataError && (
|
||||
<>
|
||||
<div className="slider-header">
|
||||
@@ -389,7 +389,7 @@ const UserProfile = () => {
|
||||
<Slider
|
||||
sliderKey="media"
|
||||
isLoading={!watchData}
|
||||
items={watchData?.recentlyWatched.map((item) => (
|
||||
items={watchData?.recentlyWatched?.map((item) => (
|
||||
<TmdbTitleCard
|
||||
key={`media-slider-item-${item.id}`}
|
||||
id={item.id}
|
||||
|
||||
Reference in New Issue
Block a user