mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2025-12-24 18:32:41 +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);
|
||||
|
||||
useEffect(()=>{
|
||||
blocking ? dialogRef.current?.showModal() : dialogRef.current?.show();
|
||||
}, [dialogRef.current]);
|
||||
|
||||
console.log(dismissKeys);
|
||||
if (dismissKeys.length === 0) {
|
||||
return null;
|
||||
}
|
||||
if (dismissKeys.length !== 0) {
|
||||
blocking ? dialogRef.current?.showModal() : dialogRef.current?.show();
|
||||
}
|
||||
}, [dialogRef.current, dismissKeys]);
|
||||
|
||||
const dismiss = () => {
|
||||
dismissKeys.forEach(key => {
|
||||
@@ -22,7 +19,7 @@ function Dialog({ dismissKeys, closeText = 'Close', blocking = false, ...rest })
|
||||
});
|
||||
dialogRef.current?.close();
|
||||
};
|
||||
console.log('rendering');
|
||||
|
||||
return (
|
||||
<dialog ref={dialogRef} onCancel={dismiss} {...rest}>
|
||||
{rest.children}
|
||||
|
||||
@@ -22,7 +22,6 @@ const NotificationPopup = ()=>{
|
||||
|
||||
try {
|
||||
const res = await request.get('/admin/notification/all');
|
||||
console.log('res', res.body);
|
||||
pickActiveNotifications(res.body || []);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
Reference in New Issue
Block a user