@homebound/beam 2.91.3 → 2.91.4
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.
|
@@ -7,6 +7,15 @@ const utils_1 = require("../../utils");
|
|
|
7
7
|
function useModal() {
|
|
8
8
|
const { modalState, modalCanCloseChecks } = (0, BeamContext_1.useBeamContext)();
|
|
9
9
|
const lastCanClose = (0, react_1.useRef)();
|
|
10
|
+
(0, react_1.useEffect)(() => {
|
|
11
|
+
// Capture the lastCanClose from when the `useEffect` runs, so that when our cleanup
|
|
12
|
+
// lambda is called later, we clean up the as-when-scheduled value, and not the super-latest
|
|
13
|
+
// value, because then we need up nuking the actually valid current value.
|
|
14
|
+
const { current } = lastCanClose;
|
|
15
|
+
return () => {
|
|
16
|
+
modalCanCloseChecks.current = modalCanCloseChecks.current.filter((c) => c !== current);
|
|
17
|
+
};
|
|
18
|
+
}, [modalCanCloseChecks]);
|
|
10
19
|
return (0, react_1.useMemo)(() => ({
|
|
11
20
|
openModal(props) {
|
|
12
21
|
// TODO Check already open?
|