Skip to content

Commit

Permalink
Disable encounter create during save (#9795)
Browse files Browse the repository at this point in the history
* Enhance encounter data handling by adding encounterId prop across multiple components

- Added `encounterId` prop to `ObservationChart`, `ObservationHistoryTable`, `ObservationsList`, `QuestionnaireResponsesList`, and `StructuredResponseView` components to improve data fetching and display related to specific encounters.
- Updated query parameters in API calls to include `encounterId` for better data context.
- Refactored `EncounterPlotsTab` and `EncounterUpdatesTab` to pass the new `encounterId` prop, ensuring consistent data handling across the application.

This change improves the overall functionality and user experience by ensuring that encounter-specific data is accurately retrieved and displayed.

* fix: disable encounter create button during save to prevent multiple submissions #9794
  • Loading branch information
bodhish authored Jan 6, 2025
1 parent 7c58703 commit b208351
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/components/Encounter/CreateEncounterForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export default function CreateEncounterForm({
},
});

const { mutate: createEncounter } = useMutation({
const { mutate: createEncounter, isPending } = useMutation({
mutationFn: mutate(routes.encounter.create),
onSuccess: (data: Encounter) => {
toast.success("Encounter created successfully");
Expand Down Expand Up @@ -318,8 +318,8 @@ export default function CreateEncounterForm({
}}
/>

<Button type="submit" className="w-full">
Create Encounter
<Button type="submit" className="w-full" disabled={isPending}>
{isPending ? "Creating..." : "Create Encounter"}
</Button>
</form>
</Form>
Expand Down

0 comments on commit b208351

Please sign in to comment.