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

What's the correct way to change sortOrder? #170

Open
ospfranco opened this issue Jan 27, 2022 · 2 comments
Open

What's the correct way to change sortOrder? #170

ospfranco opened this issue Jan 27, 2022 · 2 comments
Labels
question Further information is requested

Comments

@ospfranco
Copy link

ospfranco commented Jan 27, 2022

Hi! We built an app that integrates with linear, inside we import user's org roadmap/projects, we would like to allow the user to change the order of the project directly from our app instead of having to go to Linear, so I'm trying to figure out how does the sortOrder field works, I can see it is a float, but what is the logic behind it?

if I want to move a project (p1) above another one (p2) I could just do sortOrder - 1 (p1.sortOrder = p2.sortOrder -1) but I guess that will come back and bite me in the ass at some point

Any pointers would be really appreciated

@eldh
Copy link
Member

eldh commented Jan 27, 2022

That will work the first time you do it, but you'll run into problem the second time you try to place something above p2. It's better to place the project between two other items, if possible.

@ospfranco
Copy link
Author

ospfranco commented Jan 27, 2022

right, so the question is:

What's the right way to calculate this value?

from my testing when I move a project in the linear app not only that value changes, but it seems the entire list is somehow re-ordered? If you could at least share the high-level logic I could implement something on my own

@pacocoursey pacocoursey added the question Further information is requested label Aug 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants