From 638c38ff13abdcdbec98323732a8b81e966b20d8 Mon Sep 17 00:00:00 2001 From: Dennis Kigen Date: Thu, 8 Feb 2024 03:52:51 +0300 Subject: [PATCH] (feat) Preload form schemas on hover (#221) --- src/components/dashboard/dashboard.component.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/dashboard/dashboard.component.tsx b/src/components/dashboard/dashboard.component.tsx index 56d4c292..e7304839 100644 --- a/src/components/dashboard/dashboard.component.tsx +++ b/src/components/dashboard/dashboard.component.tsx @@ -37,8 +37,9 @@ import { useLayoutType, usePagination, useDebounce, + openmrsFetch, } from '@openmrs/esm-framework'; -import type { KeyedMutator } from 'swr'; +import { type KeyedMutator, preload } from 'swr'; import type { Form as TypedForm } from '../../types'; import { deleteForm } from '../../forms.resource'; @@ -306,6 +307,7 @@ function FormsList({ forms, isValidating, mutate, t }: FormsListProps) { }, ]; + const editSchemaUrl = '${openmrsSpaBase}/form-builder/edit/${formUuid}'; const { paginated, goTo, results, currentPage } = usePagination(filteredForms, pageSize); const tableRows = results?.map((form: TypedForm) => ({ @@ -314,7 +316,9 @@ function FormsList({ forms, isValidating, mutate, t }: FormsListProps) { name: ( void preload(`/ws/rest/v1/form/${form?.uuid}?v=full`, openmrsFetch)} > {form.name}