-
Notifications
You must be signed in to change notification settings - Fork 111
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
[Woo POS] Split container and list states with new pagination #14727
[Woo POS] Split container and list states with new pagination #14727
Conversation
Generated by 🚫 Danger |
📲 You can test the changes from this Pull Request in WooCommerce iOS by scanning the QR code below to install the corresponding build.
|
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.
Apology for the overlapping changes that took longer than I expected to wrap up, I foresee some conflicts in the items controller. Left some initial comments, will review it in depth tomorrow.
private var isInitialLoading: Bool = true | ||
private let paginationTracker: PaginationTracker | ||
private(set) var itemsViewStatePublisher: any Publisher<ItemsViewState, Never> | ||
private var itemsViewStateSubject: PassthroughSubject<ItemsViewState, Never> = .init() |
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.
Any reasons not having this as a CurrentValueSubject
and use its value
when needed, or a @Published var
?
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.
Not a published var because it's not an observable object (and I wanted to keep POSModel as the only one, partly for possibly easier moves to Observable.
It could be a CurrentValueSubject, I just haven't tried it. No time left today but feel free to make that change if you think it'd be an improvement...
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.
I see, I think it's an improvement not having to need a separate private variable with didSet to sync with the subject. Updated in 00fc51f and it seems to work fine from testing.
…3-split-container-and-list-states-with-new-pagination
@jaclync this has the pagination changes merged in now – testing since then has been limited. There's definitely still an issue when the page size is small, on pull to refresh – the pull to refresh view translation seems to trigger the That gesture needs a work anyway, because of the pre-existing issues, so I'm treating it as out of scope for this PR. Let me know what you think about the approach |
… version `AsyncPaginationTracker`.
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 so far with testing, I confirm the issue where pulling to refresh without a full height of items triggers the network request twice even with page size 100. Created an issue #14735.
Updating the PR from the comments, and will test again.
|
||
POSConnectivityView() | ||
} | ||
.environment(\.floatingControlAreaSize, | ||
CGSizeMake(floatingSize.width + Constants.floatingControlHorizontalOffset, | ||
floatingSize.height + Constants.floatingControlVerticalOffset)) | ||
.environment(\.posBackgroundAppearance, posModel.paymentState != .processingPayment ? .primary : .secondary) | ||
.animation(.easeInOut, value: posModel.itemListState == .initialLoading) | ||
.animation(.easeInOut, value: posModel.itemsViewState.containerState == .loading) |
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.
Nice having a separate container state from the changes in this file 👍
WooCommerce/Classes/Tools/InfiniteScroll/PaginationTracker.swift
Outdated
Show resolved
Hide resolved
WooCommerce/WooCommerceTests/POS/Controllers/PointOfSaleItemsControllerTests.swift
Outdated
Show resolved
Hide resolved
…ueSubject` so that it does not require another private variable with didSet.
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.
LGTM from testing with WPCOM account login and site credentials login, and the scenarios in the testing steps Just the issue when the item list is short on pull-to-refresh, which I will look into as a separate fix.
Thanks for all the improvements @jaclync! |
Closes: #14693
Description
This updates the Items view state to split out container states from list states.
It also lays the groundwork for having a hierarchy of lists including variation details.
Testing information
This changes how the state is represented for the item list as a container.
Testing should cover:
Errors during 2nd and subsequent page loads and pull to refresh will still be full screen, as will empty state.
RELEASE-NOTES.txt
if necessary.Reviewer (or Author, in the case of optional code reviews):
Please make sure these conditions are met before approving the PR, or request changes if the PR needs improvement: