Skip to content

Conversation

@C-Otto
Copy link
Collaborator

@C-Otto C-Otto commented Jan 26, 2025

fixes #13145

@mertalev
Copy link
Member

It's better to handle this in the query itself rather than in the client. #12214 is quite old and needs a rebase, but it handles sorting among other things.

@C-Otto
Copy link
Collaborator Author

C-Otto commented Jan 26, 2025

That won't work because Object.keys and Object.entries are used, which don't retain the order of the items passed in. There's already a "sort" operation in the existing web code, which doesn't work for this reason. Sorting in the backend has the same effect: none.

@mertalev
Copy link
Member

That won't work because Object.keys and Object.entries are used, which don't retain the order of the items passed in. There's already a "sort" operation in the existing web code, which doesn't work for this reason. Sorting in the backend has the same effect: none.

I'm pretty sure it did work at the time that I wrote it. It's possible that the current client code does things that would make it behave differently, though.

@C-Otto
Copy link
Collaborator Author

C-Otto commented Jan 26, 2025

As you can see in the linked issue's screenshots, there currently is no sorting.

@alextran1502
Copy link
Member

Hello, have you tested with the test case of the following folder name or tag name to see if they are sorted naturally?

1-folder
2-folder
11-folder
12-folder

@C-Otto
Copy link
Collaborator Author

C-Otto commented Jan 26, 2025

image

@alextran1502
Copy link
Member

So, it looks like the natural order isn't working here. Did it sort in natural order before the changes?

@C-Otto
Copy link
Collaborator Author

C-Otto commented Jan 26, 2025

It works, as shown on the screenshot? What kind of "natural order" do you think of? Before, there was no sorting at all, just random.

@alextran1502
Copy link
Member

So I think natural order as in

1 -> 2 -> 11 -> 12

In the screenshot it is showing

1 -> 11 -> 2 -> 12

@C-Otto
Copy link
Collaborator Author

C-Otto commented Jan 26, 2025

We're dealing with strings here, though. Different game, different rules :)

@alextran1502 alextran1502 merged commit e864811 into main Jan 26, 2025
40 checks passed
@alextran1502 alextran1502 deleted the fix-sort-folders branch January 26, 2025 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Folder view sorts months alphabetically

4 participants