From 61f432914c33d51ef20c2756b3a8dd51e28b33b7 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Tue, 21 Dec 2021 17:27:51 +0100 Subject: [PATCH] optimize payment schedules list loading --- .../payment-schedule/payment-schedules-list.tsx | 9 +-------- app/services/payment_schedule_service.rb | 2 +- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/app/frontend/src/javascript/components/payment-schedule/payment-schedules-list.tsx b/app/frontend/src/javascript/components/payment-schedule/payment-schedules-list.tsx index 7288fba22..0bd68c330 100644 --- a/app/frontend/src/javascript/components/payment-schedule/payment-schedules-list.tsx +++ b/app/frontend/src/javascript/components/payment-schedule/payment-schedules-list.tsx @@ -1,4 +1,4 @@ -import React, { useEffect, useState } from 'react'; +import React, { useState } from 'react'; import { useTranslation } from 'react-i18next'; import { react2angular } from 'react2angular'; import { DocumentFilters } from '../document-filters'; @@ -38,13 +38,6 @@ const PaymentSchedulesList: React.FC = ({ currentUser // current filter, by date, for the schedules and the deadlines const [dateFilter, setDateFilter] = useState(null); - /** - * When the component is loaded first, refresh the list of schedules to fill the first page. - */ - useEffect(() => { - handleRefreshList(); - }, []); - /** * Fetch from the API the payments schedules matching the given filters and reset the results table with the new schedules. */ diff --git a/app/services/payment_schedule_service.rb b/app/services/payment_schedule_service.rb index 14dd6e078..4de55337e 100644 --- a/app/services/payment_schedule_service.rb +++ b/app/services/payment_schedule_service.rb @@ -127,7 +127,7 @@ class PaymentScheduleService # @param filters {Hash} allowed filters: reference, customer, date. ## def self.list(page, size, filters = {}) - ps = PaymentSchedule.includes(:invoicing_profile, :payment_schedule_items) + ps = PaymentSchedule.includes(:invoicing_profile, :payment_schedule_items, :payment_schedule_objects) .joins(:invoicing_profile) .order('payment_schedules.created_at DESC') .page(page)