Skip to content

Commit 0f123b5

Browse files
committed
v0.3.2 FIX dialog methods should check hiddenRef instead of hidden state
1 parent df8495a commit 0f123b5

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-bootstrap-easy-dialog",
3-
"version": "0.3.1",
3+
"version": "0.3.2",
44
"description": "React Bootstrap Dialog made easy",
55
"keywords": [
66
"react-bootstrap",

src/Dialog.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export function DialogProvider({ children, ...providerOptions }) {
1616
const [show, setShow] = useState(false);
1717
const [showOptions, setShowOptions] = useState({});
1818
const [hidden, setHidden] = useState(true);
19+
const hiddenRef = useRef(hidden);
1920
const previousHiddenRef = useRef(hidden);
2021
const resolveDoneRef = useRef(null);
2122
const resolveHiddenRef = useRef(null);
@@ -44,6 +45,7 @@ export function DialogProvider({ children, ...providerOptions }) {
4445
}
4546

4647
useEffect(() => {
48+
hiddenRef.current = hidden;
4749
const previousHidden = previousHiddenRef.current;
4850
previousHiddenRef.current = hidden;
4951
if (previousHidden === false && hidden === true) {
@@ -54,7 +56,7 @@ export function DialogProvider({ children, ...providerOptions }) {
5456
const dialog = useMemo(() => {
5557
function buildMethod(methodOptions, failValue, okValue) {
5658
return function(text, userOptions) {
57-
if (!hidden) return failValue;
59+
if (!hiddenRef.current) return failValue;
5860

5961
setShow(true);
6062
setHidden(false);

0 commit comments

Comments
 (0)