From 2d395a89693e6f975d68ae85f6c2ef9a37a21b41 Mon Sep 17 00:00:00 2001 From: Saurabh Kumar <theskumar@users.noreply.github.com> Date: Thu, 21 Mar 2024 20:19:57 +0800 Subject: [PATCH] Reduce the lazy load time for applicant submission on dashboard (#3815) Right now, the my submission for the applicants on their dashboard is loaded after 1s of page load which is too much delay. This PR reduces the delay so it's the loading via htmx is triggered as soon as the page is finished loading. Also, the PR reduces the loading preview/skeleton to 3 so there is must of jumpiness before/after the submissions are loading, this is based on the fact that on an average there we only few submission by a single applicant. --- .../dashboard/templates/dashboard/applicant_dashboard.html | 2 +- hypha/apply/dashboard/views.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/hypha/apply/dashboard/templates/dashboard/applicant_dashboard.html b/hypha/apply/dashboard/templates/dashboard/applicant_dashboard.html index 9ae7a0b1e..3718cb8b0 100644 --- a/hypha/apply/dashboard/templates/dashboard/applicant_dashboard.html +++ b/hypha/apply/dashboard/templates/dashboard/applicant_dashboard.html @@ -44,7 +44,7 @@ <h2 class="font-light flex-1">{% trans "My submissions" %}</h2> </div> - <div hx-get="{% url 'dashboard:applicant_submissions' %}" hx-trigger="load delay:1000" id="submissions_list"> + <div hx-get="{% url 'dashboard:applicant_submissions' %}" hx-trigger="load" id="submissions_list"> {% for dummy_item in per_section_items %} <div class="wrapper wrapper--status-bar-outer animate-pulse min-h-40"> <div class="mt-5 ms-4 lg:max-w-[30%] h-9 bg-gray-200 "></div> diff --git a/hypha/apply/dashboard/views.py b/hypha/apply/dashboard/views.py index fc2954971..766fadbc5 100644 --- a/hypha/apply/dashboard/views.py +++ b/hypha/apply/dashboard/views.py @@ -521,9 +521,10 @@ class ApplicantDashboardView(TemplateView): context["my_submissions_exists"] = ApplicationSubmission.objects.filter( user=self.request.user ).exists() - context["per_section_items"] = range( - 5 - ) # it is just for animation, nothing to do with no of items there. + + # Number of items to show in skeleton in each section of lazy loading + context["per_section_items"] = range(3) + context["my_projects_exists"] = Project.objects.filter( user=self.request.user ).exists() -- GitLab