-
Notifications
You must be signed in to change notification settings - Fork 14
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
FF: The order of individualForSegment is reversed when fetched from backend #1827
Comments
@ppratikcr7 @Yagnik56 @RidhamShah Could any of you please take a look at this and see if it can be easily fixed in the backend? Thank you! |
I tried this again, and it seems the issue doesn't occur consistently. The order isn't always reversed; sometimes, it's randomly rearranged. It would be helpful if there were a way to guarantee the order matches the user's input. |
@RidhamShah Have you worked on this issue? I can't reproduce the order of the values being reversed for some reason. It seems like the values are now ordered alphabetically after refreshing the page. Ideally, I think it should always be the same order as what the user originally entered. For example, if the user entered Maybe we can discuss this in the meeting today. Agreed. Order of creation should be used, even on refresh. |
@RidhamShah Just to remind you. We have agreed that the order of creation should be used, even on refresh. |
@zackcl Yes, I am looking into this issue. |
@zackcl So, we are storing the complete list elements again on edit and all the list elements will have the same creation time, so maintaining a proper order is not possible until we add some unique identifier numbering during insertion. So we cant return the order from DB as the createdAt time is same for all the list values of a FF. Better we take alphabetical approach and sort users alphabetically and that will be retained on each refresh, something like shown below: |
OK, let's sort the elements alphabetically for now. I think sorting should be applied whenever the user updates the Values field and loses focus (so that users will see the sorted order before they click "Create" or "Save"). |
So, I have it working as discussed, will create a PR soon. But observed a small UI bug where the scroll is not working as expected, when 3rd row of values are added, the top row is half visible. Will create a separate for anyone who wants to take that up. |
@zackcl Can you please QA this? |
QA: Passed |
Version where bug was found:
5.2.0
Describe the bug
The order of
individualForSegment
is reversed when fetched from the backend. The order appears correct in the Postgres DB, but it is reversed when retrieved from the backend.To Reproduce
Steps to reproduce the behavior:
Expected behavior
The order of
individualForSegment
in the fetched FeatureFlag data should match the order stored in the DB.Additional context
The order of the fetched
featureFlagSegmentInclusion
(which contains the include lists) also doesn’t seem to match the order stored in the Postgres DB. We currently sort the array by thecreatedAt
date in the frontend (selector), but ideally, sorting in the frontend shouldn’t be necessary.The text was updated successfully, but these errors were encountered: