From d37e8e02e59c1818832aa0edc3bd1608f20e0912 Mon Sep 17 00:00:00 2001 From: Mahmoud-Da Date: Mon, 27 Oct 2025 12:55:37 +0900 Subject: [PATCH] fix(agenda): Prevent infinite loop in ReservationList The componentDidUpdate method was using a shallow prop comparison (prevProps !== this.props), causing an infinite re-render loop if unstable props like a theme object were passed. This change replaces the shallow comparison with a specific check on the props that should trigger a data update (, ), resolving the 'Maximum update depth exceeded' error. --- src/agenda/reservation-list/index.tsx | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/agenda/reservation-list/index.tsx b/src/agenda/reservation-list/index.tsx index f364d9c835..269a04a42f 100644 --- a/src/agenda/reservation-list/index.tsx +++ b/src/agenda/reservation-list/index.tsx @@ -106,14 +106,15 @@ class ReservationList extends Component { this.updateDataSource(this.getReservations(this.props).reservations); } - componentDidUpdate(prevProps: ReservationListProps) { - if (this.props.topDay && prevProps.topDay && prevProps !== this.props) { - if (!sameDate(prevProps.topDay, this.props.topDay)) { - this.setState({reservations: []}, - () => this.updateReservations(this.props) - ); - } else { - this.updateReservations(this.props); + componentDidUpdate(prevProps) { + if (this.props.topDay && prevProps.topDay) { + if (this.props.items !== prevProps.items || !sameDate(this.props.selectedDay, prevProps.selectedDay)) { + if (!sameDate(prevProps.topDay, this.props.topDay)) { + this.setState({ reservations: [] }, () => this.updateReservations(this.props)); + } + else { + this.updateReservations(this.props); + } } } }