-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
MBL-1039: Refactor LoadingBarButtonItem to take a closure instead of a binding for save actions #1881
Conversation
@@ -74,17 +74,12 @@ struct ReportProjectFormView: View { | |||
viewModel.inputs.viewDidLoad() | |||
} | |||
.onReceive(viewModel.$bannerMessage) { newValue in | |||
showLoading = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is moved up in the view model
…a binding for save actions
5769716
to
46a835a
Compare
@@ -243,6 +244,10 @@ public final class ChangeEmailViewModelSwiftUIIntegrationTest: ChangeEmailViewMo | |||
self.viewDidLoadProperty.value = () | |||
} | |||
|
|||
public func didTapSaveButton() { | |||
self.saveTriggered.send(true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactoring this to be a stream of voids would be a slightly bigger project; leaving that for another day.
// An API error happens. | ||
// We need to catch this up here in flatMap, instead of in sink, | ||
// because we don't want an API failure to cancel this pipeline. | ||
// If the pipeline gets canceled, you can't re-submit after a failure. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was something interesting I noticed while testing. Any error in a pipeline cancels/finishes the entire pipeline.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good find! That's useful to know!
Codecov Report
@@ Coverage Diff @@
## main #1881 +/- ##
==========================================
- Coverage 83.83% 83.83% -0.01%
==========================================
Files 1224 1224
Lines 111347 111349 +2
Branches 29599 29601 +2
==========================================
- Hits 93350 93349 -1
- Misses 16984 16989 +5
+ Partials 1013 1011 -2
... and 1 file with indirect coverage changes 📣 Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
// An API error happens. | ||
// We need to catch this up here in flatMap, instead of in sink, | ||
// because we don't want an API failure to cancel this pipeline. | ||
// If the pipeline gets canceled, you can't re-submit after a failure. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good find! That's useful to know!
…a binding for save actions (#1881)
📲 What
This refactors
LoadingBarButtonItem
to take a closure.🤔 Why
This pattern more closely follows how Apple handles save actions (e.g. in the
Button
class), which will make our code a little bit more canonical.✅ Acceptance criteria