From 3cc04b5194c73889f9428eab01cef5cb2b0c1261 Mon Sep 17 00:00:00 2001 From: OttoHatt <68089630+OttoHatt@users.noreply.github.com> Date: Sun, 2 Jul 2023 14:03:40 +0100 Subject: [PATCH 1/2] feat: Accept observable in Blend.Single returning nil --- src/blend/src/Shared/Blend/Blend.lua | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/blend/src/Shared/Blend/Blend.lua b/src/blend/src/Shared/Blend/Blend.lua index 5e65e32099..d83186178b 100644 --- a/src/blend/src/Shared/Blend/Blend.lua +++ b/src/blend/src/Shared/Blend/Blend.lua @@ -787,14 +787,13 @@ function Blend.Single(observable) local copy = BrioUtils.clone(result) maid._current = copy sub:Fire(copy) - return copy + elseif result then + local current = Brio.new(result) + maid._current = current + sub:Fire(current) + else + maid._current = nil end - - local current = Brio.new(result) - maid._current = current - sub:Fire(current) - - return current end)) return maid @@ -1087,4 +1086,4 @@ function Blend.mount(instance, props) end -return Blend \ No newline at end of file +return Blend From 25c5044863ce2e5a67df54eb718565069ce97a23 Mon Sep 17 00:00:00 2001 From: OttoHatt <68089630+OttoHatt@users.noreply.github.com> Date: Sun, 2 Jul 2023 14:09:56 +0100 Subject: [PATCH 2/2] fix: Propagate observable state into Blend.Single --- src/blend/src/Shared/Blend/Blend.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/blend/src/Shared/Blend/Blend.lua b/src/blend/src/Shared/Blend/Blend.lua index d83186178b..c165f4f8af 100644 --- a/src/blend/src/Shared/Blend/Blend.lua +++ b/src/blend/src/Shared/Blend/Blend.lua @@ -794,6 +794,10 @@ function Blend.Single(observable) else maid._current = nil end + end, function(...) + sub:Fail(...) + end, function(...) + sub:Complete(...) end)) return maid @@ -1086,4 +1090,4 @@ function Blend.mount(instance, props) end -return Blend +return Blend \ No newline at end of file