[NT-409] Fix issue with feature flags ordering #879
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📲 What
#877 has recently broken the way we can toggle feature flags ON and OFF so this PR fixes that.
🤔 Why
The toggling was previously broken due to sorting only being applied to the data source (not the actual data being sorted).
reloadWithData
did get the sorted array whileupdateConfigWithFeatures
did not ... therefore when the data was fetched from the server in un-sorted order it would cause weird behaviour (the data displayed would not reflect the data being toggled ON/OFF).🛠 How
This PR should fix that by both applying sort to
updateConfigWithFeatures
as well as adding tests to cover this case.✅ Acceptance criteria
In order to test this we should test both scenarios. For that please put the following code in
FeatureFlagToolsViewModel.swift
on line46
.Since the feature toggles are returned in random order you might need to run the app couple times.
A) Feature toggles are received in alphabetical order
ON
andOFF
and double check they're affecting app's behaviour (proper native checkout flow)B) Feature toggles are not received in alphabetical order
ON
andOFF
and double check they're affecting app's behaviour (proper native checkout flow)