mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2025-12-28 13:32:39 +00:00
move back to conditional showing instead of conditional rendering
This commit is contained in:
@@ -6,13 +6,10 @@ function Dialog({ dismissKeys, closeText = 'Close', blocking = false, ...rest })
|
|||||||
const dialogRef = useRef(null);
|
const dialogRef = useRef(null);
|
||||||
|
|
||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
blocking ? dialogRef.current?.showModal() : dialogRef.current?.show();
|
if (dismissKeys.length !== 0) {
|
||||||
}, [dialogRef.current]);
|
blocking ? dialogRef.current?.showModal() : dialogRef.current?.show();
|
||||||
|
}
|
||||||
console.log(dismissKeys);
|
}, [dialogRef.current, dismissKeys]);
|
||||||
if (dismissKeys.length === 0) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
const dismiss = () => {
|
const dismiss = () => {
|
||||||
dismissKeys.forEach(key => {
|
dismissKeys.forEach(key => {
|
||||||
@@ -22,7 +19,7 @@ function Dialog({ dismissKeys, closeText = 'Close', blocking = false, ...rest })
|
|||||||
});
|
});
|
||||||
dialogRef.current?.close();
|
dialogRef.current?.close();
|
||||||
};
|
};
|
||||||
console.log('rendering');
|
|
||||||
return (
|
return (
|
||||||
<dialog ref={dialogRef} onCancel={dismiss} {...rest}>
|
<dialog ref={dialogRef} onCancel={dismiss} {...rest}>
|
||||||
{rest.children}
|
{rest.children}
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ const NotificationPopup = ()=>{
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await request.get('/admin/notification/all');
|
const res = await request.get('/admin/notification/all');
|
||||||
console.log('res', res.body);
|
|
||||||
pickActiveNotifications(res.body || []);
|
pickActiveNotifications(res.body || []);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
|
|||||||
Reference in New Issue
Block a user