Skip to content
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

(Bug report) Promoted relations not in correct order #4105

Closed
mm21 opened this issue Jul 19, 2023 · 4 comments
Closed

(Bug report) Promoted relations not in correct order #4105

mm21 opened this issue Jul 19, 2023 · 4 comments

Comments

@mm21
Copy link
Contributor

mm21 commented Jul 19, 2023

Trilium Version

next61 (f8c9178)

What operating system are you using?

Ubuntu

What is your setup?

Server access only

Operating System Version

Ubuntu 22.04 LTS

Description

The order of promoted relations:

image

Doesn't follow the actual attribute order:

image

But promoted labels seem to be ordered fine. This applies to labels too.

Error logs

No response

@mm21 mm21 added the Type: Bug label Jul 19, 2023
@mm21
Copy link
Contributor Author

mm21 commented Jul 19, 2023

For some background, these relations are created via ETAPI and can be created out of order, which I think is what's causing this.

@mm21
Copy link
Contributor Author

mm21 commented Jul 20, 2023

Did some digging and can confirm that values of promoted attributes are showing in the order in which they're created, not their position, even after restarting frontend and backend. It reproduces in the UI for me as well.

From looking at the code, I think FNote.getOwnedAttributes() is not taking position into account while FNote.getAttributes() is.

Edit: and this indeed applies to labels too, it was just a coincidence that I was creating the labels in the right order.

@zadam
Copy link
Owner

zadam commented Jul 20, 2023

Actually not even getAttributes() has guaranteed sorting. The position order of attributes is mostly important for UI in a few places and thus the data model does not keep them sorted.

So this fixes it in the promoted attributes UI.

@zadam zadam closed this as completed Jul 20, 2023
@mm21
Copy link
Contributor Author

mm21 commented Jul 23, 2023

Makes sense. Thanks for the background and quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants