Add PostAuthorPicker - #24621
Conversation
7e657d7 to
b418b3e
Compare
|
| App Name | Jetpack | |
| Configuration | Release-Alpha | |
| Build Number | 28021 | |
| Version | PR #24621 | |
| Bundle ID | com.jetpack.alpha | |
| Commit | 2afc43f | |
| Installation URL | 2u4qlkt7lvekg |
|
| App Name | WordPress | |
| Configuration | Release-Alpha | |
| Build Number | 28021 | |
| Version | PR #24621 | |
| Bundle ID | org.wordpress.alpha | |
| Commit | 2afc43f | |
| Installation URL | 0nnil28gmo6ao |
| } | ||
|
|
||
| #if DEBUG | ||
| struct PostAuthorPicker_Previews: PreviewProvider { |
There was a problem hiding this comment.
Any reason not to use #Preview?
There was a problem hiding this comment.
I removed it – these previews in the app targets are not useful anyway.
| @Environment(\.dismiss) private var dismiss | ||
|
|
||
| init(post: AbstractPost, onSelection: @escaping () -> Void) { | ||
| _viewModel = StateObject(wrappedValue: PostAuthorPickerViewModel(post: post, onSelection: onSelection)) |
There was a problem hiding this comment.
I presume this is generated by AI? I feel bad about annoying you with the same comments. Any chance we can tell AI not to generate code like this?
There was a problem hiding this comment.
Maybe we should rethink its usage. It's a standard officially documented pattern and there are only a few scenarios where it can lead to issues. It's too convenient not to use because it's the only good way to inject observable state into a view and have it retain it (state/stateObject). In this case, it's not issue because it's a new screen every time and a new view identify, to it rests.
There was a problem hiding this comment.
There are multiple precedents in the codebase where StateObject(wrappedValue:) is used. I'd continue using it where it's OK – if it's part of the new screen it's fine.
|





Closes https://linear.app/a8c/issue/CMM-529/postauthorselectorviewcontroller
Before / After