@reykjavik/hanna-react 0.10.111 → 0.10.112
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/CHANGELOG.md
CHANGED
|
@@ -74,12 +74,17 @@ const AbstractModal = (props) => {
|
|
|
74
74
|
setTimeout(props.onClosed, closeDelay);
|
|
75
75
|
}
|
|
76
76
|
};
|
|
77
|
+
// ---
|
|
78
|
+
// Update open state when props.open changes. Icky but simple.
|
|
77
79
|
const lastPropsOpen = (0, react_1.useRef)(props.open);
|
|
78
|
-
// Update state when props.open changes. Icky but simple.
|
|
79
80
|
if (props.open !== lastPropsOpen.current && props.open !== open) {
|
|
80
81
|
lastPropsOpen.current = props.open;
|
|
82
|
+
// these update state during render, which aborts the current render
|
|
83
|
+
// and triggers an immediate rerender.
|
|
81
84
|
props.open ? openModal() : closeModal();
|
|
82
85
|
}
|
|
86
|
+
lastPropsOpen.current = props.open;
|
|
87
|
+
// ---
|
|
83
88
|
const closeOnCurtainClick = isFickle &&
|
|
84
89
|
((e) => {
|
|
85
90
|
if (e.target === e.currentTarget) {
|
|
@@ -70,12 +70,17 @@ export const AbstractModal = (props) => {
|
|
|
70
70
|
setTimeout(props.onClosed, closeDelay);
|
|
71
71
|
}
|
|
72
72
|
};
|
|
73
|
+
// ---
|
|
74
|
+
// Update open state when props.open changes. Icky but simple.
|
|
73
75
|
const lastPropsOpen = useRef(props.open);
|
|
74
|
-
// Update state when props.open changes. Icky but simple.
|
|
75
76
|
if (props.open !== lastPropsOpen.current && props.open !== open) {
|
|
76
77
|
lastPropsOpen.current = props.open;
|
|
78
|
+
// these update state during render, which aborts the current render
|
|
79
|
+
// and triggers an immediate rerender.
|
|
77
80
|
props.open ? openModal() : closeModal();
|
|
78
81
|
}
|
|
82
|
+
lastPropsOpen.current = props.open;
|
|
83
|
+
// ---
|
|
79
84
|
const closeOnCurtainClick = isFickle &&
|
|
80
85
|
((e) => {
|
|
81
86
|
if (e.target === e.currentTarget) {
|