Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blend.Single changes #382

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions src/blend/src/Shared/Blend/Blend.lua
Original file line number Diff line number Diff line change
Expand Up @@ -787,14 +787,17 @@ 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, function(...)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can pass sub:GetFailComplete() here. Note I think it's fine to complete this here, but a failure could cause other observables in the blend tree to also fail. Most of Nevermore doesn't really leverage the failure state that much.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you think it's safe to merge this, I'm down for it.

Copy link
Contributor Author

@OttoHatt OttoHatt Jul 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted the completion, I didn't realise this would could pass failures. I was only vaguely aware subscriptions had this - I know for certain I'm not handling it!

Though it's a breaking change, I would want to propagate this. I think hiding errors is bad. But silently failing is also bad, because I'm not handling this case and wouldn't know why my subscription stopped. I think subscriptions should print a warning (similar to promises) for an unhandled failure state (i.e. no failCallback), and then this should be merged?

sub:Fail(...)
end, function(...)
sub:Complete(...)
end))

return maid
Expand Down