Skip to content

Relations referred to based on their position in the array rather than their identity, causing state to be incorrectly associated with different relations #7716

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

Open
lusterck opened this issue Jun 6, 2025 · 2 comments · May be fixed by #7721

Comments

@lusterck
Copy link

lusterck commented Jun 6, 2025

Describe the bug

When relations are re-sorted, relations are referred to based on their position in the array rather than their identity, causing state to be incorrectly associated with different relations.

return <RelationItem key={i} relation={rel} />;

By changing the identifier from the array index to the relation id id, we should properly track the relation items.

const RelationsList: FC<RelationsListProps> = observer(({ relations }) => {
  return (
    <>
      {relations.map((rel, i) => {
        return <RelationItem key={rel.id} relation={rel} />;
      })}
    </>
  );
});

To Reproduce
In a list of relations hover over the items before and after sorting based on order. Hovering over the first relation will highlight the last one in the list after re-sorting.

Expected behaviour
Relations are properly tracked and the component's selected values remain associated with the correct relation.

Environment (please complete the following information):

  • OS: Windows
  • Label Studio Version 1.19.0
@heidi-humansignal
Copy link
Collaborator

Hello,

Do you mind testing this on 1.19.0 please?

Thank you,
Abu

Comment by Abubakar Saad
Workflow Run

@lusterck
Copy link
Author

Hello Abu,
I can confirm the issue remains on version 1.19.0.

Thanks,
Lucas

Hello,

Do you mind testing this on 1.19.0 please?

Thank you, Abu

Comment by Abubakar Saad
Workflow Run

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

Successfully merging a pull request may close this issue.

2 participants