From 68eab3479a9ec6be11f470d83849933b6230e915 Mon Sep 17 00:00:00 2001 From: boatbomber Date: Mon, 19 Jan 2026 16:35:19 -0800 Subject: [PATCH] Fix notification unmount thread cancel bug (#1211) --- CHANGELOG.md | 3 +++ .../Components/Notifications/FullscreenNotification.lua | 8 +++++++- plugin/src/App/Components/Notifications/Notification.lua | 8 +++++++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d437eb6d..95b95859 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,13 +30,16 @@ Making a new release? Simply add the new header with the version and date undern --> ## Unreleased + * Fixed a bug caused by having reference properties (such as `ObjectValue.Value`) that point to an Instance not included in syncback. ([#1179]) * Fixed instance replacement fallback failing when too many instances needed to be replaced. ([#1192]) * Fixed a bug where MacOS paths weren't being handled correctly. ([#1201]) +* Fixed a bug where the notification timeout thread would fail to cancel on unmount ([#1211]) [#1179]: https://github.com/rojo-rbx/rojo/pull/1179 [#1192]: https://github.com/rojo-rbx/rojo/pull/1192 [#1201]: https://github.com/rojo-rbx/rojo/pull/1201 +[#1211]: https://github.com/rojo-rbx/rojo/pull/1211 ## [7.7.0-rc.1] (November 27th, 2025) diff --git a/plugin/src/App/Components/Notifications/FullscreenNotification.lua b/plugin/src/App/Components/Notifications/FullscreenNotification.lua index 215398b2..47d0ae6f 100644 --- a/plugin/src/App/Components/Notifications/FullscreenNotification.lua +++ b/plugin/src/App/Components/Notifications/FullscreenNotification.lua @@ -19,9 +19,15 @@ local FullscreenNotification = Roact.Component:extend("FullscreeFullscreenNotifi function FullscreenNotification:init() self.transparency, self.setTransparency = Roact.createBinding(0) self.lifetime = self.props.timeout + self.dismissed = false end function FullscreenNotification:dismiss() + if self.dismissed then + return + end + self.dismissed = true + if self.props.onClose then self.props.onClose() end @@ -59,7 +65,7 @@ function FullscreenNotification:didMount() end function FullscreenNotification:willUnmount() - if self.timeout and coroutine.status(self.timeout) ~= "dead" then + if self.timeout and coroutine.status(self.timeout) == "suspended" then task.cancel(self.timeout) end end diff --git a/plugin/src/App/Components/Notifications/Notification.lua b/plugin/src/App/Components/Notifications/Notification.lua index 47fb0d08..1d9464c9 100644 --- a/plugin/src/App/Components/Notifications/Notification.lua +++ b/plugin/src/App/Components/Notifications/Notification.lua @@ -25,6 +25,7 @@ function Notification:init() self.binding = bindingUtil.fromMotor(self.motor) self.lifetime = self.props.timeout + self.dismissed = false self.motor:onStep(function(value) if value <= 0 and self.props.onClose then @@ -34,6 +35,11 @@ function Notification:init() end function Notification:dismiss() + if self.dismissed then + return + end + self.dismissed = true + self.motor:setGoal(Flipper.Spring.new(0, { frequency = 5, dampingRatio = 1, @@ -75,7 +81,7 @@ function Notification:didMount() end function Notification:willUnmount() - if self.timeout and coroutine.status(self.timeout) ~= "dead" then + if self.timeout and coroutine.status(self.timeout) == "suspended" then task.cancel(self.timeout) end end