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]: using API to PATCH issue labels causes the label to be **repeated** in API response #5997

Open
1 task done
xmok opened this issue Nov 13, 2024 · 0 comments
Open
1 task done
Assignees
Labels
🐛bug Something isn't working

Comments

@xmok
Copy link

xmok commented Nov 13, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

When I use the API to PATCH an Issue's Labels, there are 2 issues:

SCENARIO 1. If we PATCH an existing label i.e. an already assigned label, the label is repeated in the DB/Response though the UI only shows unique labels. I would expect the label to not be repeated in the DB.
SCENARIO 2. Sending empty array of labels does NOT remove the labels from the API response though it DOES from the UI. I would expect empty array to remove all the labels even from response.

It seems like the UI is using a label_ids field which is different from the labels field returned by API.

Steps to reproduce

curl pseudo

GET https://api.plane.so/api/v1/workspaces/<SLUG>/projects/<PROJECT>/issues/<ISSUES>/?fields=labels
response:

{
 "labels": [
    "c8561e63-3142-4735-a5d9-8af511a4525d",
    "c8561e63-3142-4735-a5d9-8af511a4525d",
    "c8561e63-3142-4735-a5d9-8af511a4525d",
    "c8561e63-3142-4735-a5d9-8af511a4525d",
    "c8561e63-3142-4735-a5d9-8af511a4525d",
    "c8561e63-3142-4735-a5d9-8af511a4525d",
    "1f118077-ea29-4595-81b0-ecb8c6241352",
    "1f118077-ea29-4595-81b0-ecb8c6241352",
    "1f118077-ea29-4595-81b0-ecb8c6241352"
  ]
}
PATCH https://api.plane.so/api/v1/workspaces/<SLUG>/projects/<PROJECT>/issues/<ISSUES>/

{
  "labels": ["1f118077-ea29-4595-81b0-ecb8c6241352"]
}

THEN again:
GET https://api.plane.so/api/v1/workspaces/<SLUG>/projects/<PROJECT>/issues/<ISSUES>/?fields=labels
response:

{
 "labels": [
    "c8561e63-3142-4735-a5d9-8af511a4525d",
    "c8561e63-3142-4735-a5d9-8af511a4525d",
    "c8561e63-3142-4735-a5d9-8af511a4525d",
    "c8561e63-3142-4735-a5d9-8af511a4525d",
    "c8561e63-3142-4735-a5d9-8af511a4525d",
    "c8561e63-3142-4735-a5d9-8af511a4525d",
    "1f118077-ea29-4595-81b0-ecb8c6241352",
    "1f118077-ea29-4595-81b0-ecb8c6241352",
    "1f118077-ea29-4595-81b0-ecb8c6241352",
    "1f118077-ea29-4595-81b0-ecb8c6241352"
  ]
}

NOTICE there are now FOUR of the PATCHed ID.

Videos

ONE: PATCH new label - this video shows that I add a new label using API which is reflected on the UI but the labels in API get the label APPENDED.

plane-patch-new-label.mp4

TWO: PATCH empty - this video shows that I set labels to empty which a-OK in the UI but the API response still has the labels.

plane-patch-empty.mp4

Environment

Production

Browser

None

Variant

Cloud

Version

Cloud?

@xmok xmok added the 🐛bug Something isn't working label Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants