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

Fix record position calculation #5427

Closed
FelixMalfait opened this issue May 15, 2024 · 0 comments · Fixed by #5690
Closed

Fix record position calculation #5427

FelixMalfait opened this issue May 15, 2024 · 0 comments · Fixed by #5690

Comments

@FelixMalfait
Copy link
Member

In record-position.factory.ts we currently have:

    return (
      (value === 'first'
        ? records[0]?.position / 2
        : records[0]?.position + 1) || 1
    );

That's an issue because if we use first 20 times in a row then we'll reach the limit of float precision.

We should probably instead allow negative numbers, and when someone passes "last" then do -1.

We should only use "/2" across the app in the rarest occurence when we want to insert a record between 2 given records.

Also, once that change is done we should make sure the default param when creating a record is "first" and not "last". That way the records created through the API will show up at the top which would be consistent with what we do in the UI when creating a new record with "+"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: ✅ Done
Development

Successfully merging a pull request may close this issue.

3 participants