Skip to content

Commit c77f6d8

Browse files
committed
fix: clear stale stack log container selection
1 parent a5b8626 commit c77f6d8

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

‎apps/dokploy/components/dashboard/compose/logs/show-stack.tsx‎

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,16 @@ export const ShowDockerLogsStack = ({
7474
useEffect(() => {
7575
const currentContainers = option === "native" ? containers : services;
7676

77-
if (
78-
currentContainers &&
79-
currentContainers.length > 0 &&
80-
(!containerId ||
81-
!currentContainers.some(
82-
(container) => container.containerId === containerId,
83-
))
84-
) {
85-
setContainerId(currentContainers[0]?.containerId);
77+
if (currentContainers) {
78+
const nextContainerId = currentContainers.some(
79+
(container) => container.containerId === containerId,
80+
)
81+
? containerId
82+
: currentContainers[0]?.containerId;
83+
84+
if (nextContainerId !== containerId) {
85+
setContainerId(nextContainerId);
86+
}
8687
}
8788
}, [option, services, containers, containerId]);
8889

0 commit comments

Comments
 (0)