woocommerce / woocommerce-android

WooCommerce Android app
https://www.woocommerce.com/mobile
GNU General Public License v2.0
277 stars 134 forks source link

[Tablet Support M3] After rotating the screen variation selection result is lost #10867

Open samiuelson opened 6 months ago

jd-alexander commented 5 months ago

I attempted to update the onSelectedVariationsUpdated method in ProductSelectorViewModel.ktto persist the updated list of selected items using the SavedStateHandle, aiming to maintain state across configuration changes This approach was modeled after the existing pattern used for _selectedItems, where the initial state is retrieved from SavedStateHandle and subsequently updated within the ViewModel.

Despite following the established pattern, including updating the _selectedItems state flow and attempting to save the updated list of selected items back to the SavedStateHandle using the key "key_selected_items", the solution did not work as expected. The intention was to ensure that any changes to the selected items, especially after handling variation selection results, would be preserved. However, the updated list of selected items does not seem to be correctly stored or retrieved from the SavedStateHandle.

I also explored utilization of handleDialogResult but had challenges with that where all entryId I attempted to use would cause crashes.