mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-11 16:05:47 +01:00
🐛 fix bug where Docker containers still show on refresh if socket is unreachable
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { ActionIcon, Drawer, Group, LoadingOverlay, Text, Tooltip } from '@mantine/core';
|
import { ActionIcon, Drawer, Text, Tooltip } from '@mantine/core';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import Docker from 'dockerode';
|
import Docker from 'dockerode';
|
||||||
@@ -38,7 +38,9 @@ export default function DockerMenuButton(props: any) {
|
|||||||
setContainers(res.data);
|
setContainers(res.data);
|
||||||
setSelection([]);
|
setSelection([]);
|
||||||
})
|
})
|
||||||
.catch(() =>
|
.catch(() => {
|
||||||
|
// Remove containers from the list
|
||||||
|
setContainers([]);
|
||||||
// Send an Error notification
|
// Send an Error notification
|
||||||
showNotification({
|
showNotification({
|
||||||
autoClose: 1500,
|
autoClose: 1500,
|
||||||
@@ -46,8 +48,8 @@ export default function DockerMenuButton(props: any) {
|
|||||||
color: 'red',
|
color: 'red',
|
||||||
icon: <IconX />,
|
icon: <IconX />,
|
||||||
message: 'Did you forget to mount the docker socket ?',
|
message: 'Did you forget to mount the docker socket ?',
|
||||||
})
|
});
|
||||||
);
|
});
|
||||||
}, 300);
|
}, 300);
|
||||||
}
|
}
|
||||||
const exists = config.modules?.[DockerModule.title]?.enabled ?? false;
|
const exists = config.modules?.[DockerModule.title]?.enabled ?? false;
|
||||||
|
|||||||
Reference in New Issue
Block a user