Skip to content

Commit 68eab34

Browse files
authored
Fix notification unmount thread cancel bug (#1211)
1 parent 2a1102f commit 68eab34

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,16 @@ Making a new release? Simply add the new header with the version and date undern
3030
-->
3131

3232
## Unreleased
33+
3334
* Fixed a bug caused by having reference properties (such as `ObjectValue.Value`) that point to an Instance not included in syncback. ([#1179])
3435
* Fixed instance replacement fallback failing when too many instances needed to be replaced. ([#1192])
3536
* Fixed a bug where MacOS paths weren't being handled correctly. ([#1201])
37+
* Fixed a bug where the notification timeout thread would fail to cancel on unmount ([#1211])
3638

3739
[#1179]: https://github.com/rojo-rbx/rojo/pull/1179
3840
[#1192]: https://github.com/rojo-rbx/rojo/pull/1192
3941
[#1201]: https://github.com/rojo-rbx/rojo/pull/1201
42+
[#1211]: https://github.com/rojo-rbx/rojo/pull/1211
4043

4144
## [7.7.0-rc.1] (November 27th, 2025)
4245

plugin/src/App/Components/Notifications/FullscreenNotification.lua

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,15 @@ local FullscreenNotification = Roact.Component:extend("FullscreeFullscreenNotifi
1919
function FullscreenNotification:init()
2020
self.transparency, self.setTransparency = Roact.createBinding(0)
2121
self.lifetime = self.props.timeout
22+
self.dismissed = false
2223
end
2324

2425
function FullscreenNotification:dismiss()
26+
if self.dismissed then
27+
return
28+
end
29+
self.dismissed = true
30+
2531
if self.props.onClose then
2632
self.props.onClose()
2733
end
@@ -59,7 +65,7 @@ function FullscreenNotification:didMount()
5965
end
6066

6167
function FullscreenNotification:willUnmount()
62-
if self.timeout and coroutine.status(self.timeout) ~= "dead" then
68+
if self.timeout and coroutine.status(self.timeout) == "suspended" then
6369
task.cancel(self.timeout)
6470
end
6571
end

plugin/src/App/Components/Notifications/Notification.lua

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ function Notification:init()
2525
self.binding = bindingUtil.fromMotor(self.motor)
2626

2727
self.lifetime = self.props.timeout
28+
self.dismissed = false
2829

2930
self.motor:onStep(function(value)
3031
if value <= 0 and self.props.onClose then
@@ -34,6 +35,11 @@ function Notification:init()
3435
end
3536

3637
function Notification:dismiss()
38+
if self.dismissed then
39+
return
40+
end
41+
self.dismissed = true
42+
3743
self.motor:setGoal(Flipper.Spring.new(0, {
3844
frequency = 5,
3945
dampingRatio = 1,
@@ -75,7 +81,7 @@ function Notification:didMount()
7581
end
7682

7783
function Notification:willUnmount()
78-
if self.timeout and coroutine.status(self.timeout) ~= "dead" then
84+
if self.timeout and coroutine.status(self.timeout) == "suspended" then
7985
task.cancel(self.timeout)
8086
end
8187
end

0 commit comments

Comments
 (0)