Skip to content

Commit

Permalink
feat: use debounced variables for field report title generation
Browse files Browse the repository at this point in the history
  • Loading branch information
samshara committed Jan 29, 2025
1 parent c4ec46b commit f335c72
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { TextOutput } from '@ifrc-go/ui';
import { useTranslation } from '@ifrc-go/ui/hooks';

import useAlert from '#hooks/useAlert';
import useDebouncedValue from '#hooks/useDebouncedValue';
import { useRequest } from '#utils/restRequest';

import i18n from './i18n.json';
Expand Down Expand Up @@ -38,12 +39,14 @@ function TitlePreview(props: Props) {
title,
}), [country, isCovidReport, startDate, disasterType, event, title]);

const debouncedVariables = useDebouncedValue(variables);

const {
response: genereateTitleResponse,

Check warning on line 45 in app/src/views/FieldReportForm/ContextFields/TitlePreview/index.tsx

View workflow job for this annotation

GitHub Actions / Spell Check with Typos

"genereate" should be "generate".
} = useRequest({
url: '/api/v2/field-report/generate-title/',
method: 'POST',
body: variables,
body: debouncedVariables,
preserveResponse: true,
onFailure: () => {
alert.show(
Expand Down

0 comments on commit f335c72

Please sign in to comment.