@openmrs/esm-react-utils 6.3.1-pre.3073 → 6.3.1-pre.3077
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +1 -1
- package/dist/useVisit.js +3 -3
- package/package.json +12 -12
- package/src/useVisit.ts +3 -3
package/.turbo/turbo-build.log
CHANGED
package/dist/useVisit.js
CHANGED
|
@@ -40,7 +40,7 @@ dayjs.extend(isToday);
|
|
|
40
40
|
retroData,
|
|
41
41
|
retrospectiveVisitUuid
|
|
42
42
|
]);
|
|
43
|
-
const
|
|
43
|
+
const previousCurrentVisit = useRef(null);
|
|
44
44
|
useEffect(()=>{
|
|
45
45
|
// if an active visit is created and there is no visit in context, set the context to the active visit
|
|
46
46
|
if (manuallySetVisitUuid == null && !activeIsValidating && activeVisit) {
|
|
@@ -49,10 +49,10 @@ dayjs.extend(isToday);
|
|
|
49
49
|
if (!retroIsValidating) {
|
|
50
50
|
// if the current visit happened to be active but it just got ended (inactive), remove the
|
|
51
51
|
// visit from context
|
|
52
|
-
if (
|
|
52
|
+
if (previousCurrentVisit.current && currentVisit && previousCurrentVisit.current.uuid === currentVisit.uuid && !previousCurrentVisit.current.stopDatetime && currentVisit.stopDatetime) {
|
|
53
53
|
setVisitContext(null);
|
|
54
54
|
}
|
|
55
|
-
|
|
55
|
+
previousCurrentVisit.current = currentVisit;
|
|
56
56
|
}
|
|
57
57
|
}, [
|
|
58
58
|
currentVisit,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openmrs/esm-react-utils",
|
|
3
|
-
"version": "6.3.1-pre.
|
|
3
|
+
"version": "6.3.1-pre.3077",
|
|
4
4
|
"license": "MPL-2.0",
|
|
5
5
|
"description": "React utilities for OpenMRS.",
|
|
6
6
|
"type": "module",
|
|
@@ -78,17 +78,17 @@
|
|
|
78
78
|
"swr": "2.x"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
|
-
"@openmrs/esm-api": "6.3.1-pre.
|
|
82
|
-
"@openmrs/esm-config": "6.3.1-pre.
|
|
83
|
-
"@openmrs/esm-context": "6.3.1-pre.
|
|
84
|
-
"@openmrs/esm-emr-api": "6.3.1-pre.
|
|
85
|
-
"@openmrs/esm-error-handling": "6.3.1-pre.
|
|
86
|
-
"@openmrs/esm-extensions": "6.3.1-pre.
|
|
87
|
-
"@openmrs/esm-feature-flags": "6.3.1-pre.
|
|
88
|
-
"@openmrs/esm-globals": "6.3.1-pre.
|
|
89
|
-
"@openmrs/esm-navigation": "6.3.1-pre.
|
|
90
|
-
"@openmrs/esm-state": "6.3.1-pre.
|
|
91
|
-
"@openmrs/esm-utils": "6.3.1-pre.
|
|
81
|
+
"@openmrs/esm-api": "6.3.1-pre.3077",
|
|
82
|
+
"@openmrs/esm-config": "6.3.1-pre.3077",
|
|
83
|
+
"@openmrs/esm-context": "6.3.1-pre.3077",
|
|
84
|
+
"@openmrs/esm-emr-api": "6.3.1-pre.3077",
|
|
85
|
+
"@openmrs/esm-error-handling": "6.3.1-pre.3077",
|
|
86
|
+
"@openmrs/esm-extensions": "6.3.1-pre.3077",
|
|
87
|
+
"@openmrs/esm-feature-flags": "6.3.1-pre.3077",
|
|
88
|
+
"@openmrs/esm-globals": "6.3.1-pre.3077",
|
|
89
|
+
"@openmrs/esm-navigation": "6.3.1-pre.3077",
|
|
90
|
+
"@openmrs/esm-state": "6.3.1-pre.3077",
|
|
91
|
+
"@openmrs/esm-utils": "6.3.1-pre.3077",
|
|
92
92
|
"@swc/cli": "^0.7.7",
|
|
93
93
|
"@swc/core": "^1.11.29",
|
|
94
94
|
"concurrently": "^9.1.2",
|
package/src/useVisit.ts
CHANGED
|
@@ -73,7 +73,7 @@ export function useVisit(patientUuid: string, representation = defaultVisitCusto
|
|
|
73
73
|
() => (retrospectiveVisitUuid && retroData ? retroData.data : null),
|
|
74
74
|
[retroData, retrospectiveVisitUuid],
|
|
75
75
|
);
|
|
76
|
-
const
|
|
76
|
+
const previousCurrentVisit = useRef<Visit | null>(null);
|
|
77
77
|
|
|
78
78
|
useEffect(() => {
|
|
79
79
|
// if an active visit is created and there is no visit in context, set the context to the active visit
|
|
@@ -83,10 +83,10 @@ export function useVisit(patientUuid: string, representation = defaultVisitCusto
|
|
|
83
83
|
if (!retroIsValidating) {
|
|
84
84
|
// if the current visit happened to be active but it just got ended (inactive), remove the
|
|
85
85
|
// visit from context
|
|
86
|
-
if (
|
|
86
|
+
if (previousCurrentVisit.current && currentVisit && previousCurrentVisit.current.uuid === currentVisit.uuid && !previousCurrentVisit.current.stopDatetime && currentVisit.stopDatetime) {
|
|
87
87
|
setVisitContext(null);
|
|
88
88
|
}
|
|
89
|
-
|
|
89
|
+
previousCurrentVisit.current = currentVisit;
|
|
90
90
|
}
|
|
91
91
|
}, [currentVisit, manuallySetVisitUuid, activeVisit, activeIsValidating, retroIsValidating]);
|
|
92
92
|
|