From 49e0acb377d91465437a1470b1a851712cb464b8 Mon Sep 17 00:00:00 2001 From: Ly-sec Date: Wed, 20 Aug 2025 00:12:25 +0200 Subject: [PATCH] Fix notification hide issue --- Modules/Notification/Notification.qml | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/Modules/Notification/Notification.qml b/Modules/Notification/Notification.qml index e18c969..a79d60d 100644 --- a/Modules/Notification/Notification.qml +++ b/Modules/Notification/Notification.qml @@ -47,13 +47,29 @@ Variants { // Connect to animation signal from service Component.onCompleted: { NotificationService.animateAndRemove.connect(function (notification, index) { - // Find the delegate and trigger its animation - if (notificationStack.children && notificationStack.children[index]) { - let delegate = notificationStack.children[index] - if (delegate && delegate.animateOut) { - delegate.animateOut() + // Prefer lookup by identity to avoid index mismatches + var delegate = null + if (notificationStack.children && notificationStack.children.length > 0) { + for (var i = 0; i < notificationStack.children.length; i++) { + var child = notificationStack.children[i] + if (child && child.model && child.model.rawNotification === notification) { + delegate = child + break + } } } + + // Fallback to index if identity lookup failed + if (!delegate && notificationStack.children && notificationStack.children[index]) { + delegate = notificationStack.children[index] + } + + if (delegate && delegate.animateOut) { + delegate.animateOut() + } else { + // As a last resort, force-remove without animation to avoid stuck popups + NotificationService.forceRemoveNotification(notification) + } }) }