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

Can't save after deleting condition on "Segment Overrides" screen and OR button disappears #3244

Closed
2 of 4 tasks
Dogacel opened this issue Jan 5, 2024 · 3 comments · Fixed by #3269
Closed
2 of 4 tasks
Assignees
Labels
bug Something isn't working front-end Issue related to the React Front End Dashboard

Comments

@Dogacel
Copy link
Contributor

Dogacel commented Jan 5, 2024

Describe the bug

When a new condition is added to the segment override and immediately deleted without being modified, it doesn't allow

To Reproduce

Steps to reproduce the behavior:

  1. Go to 'Features', click on a feature.
  2. Go to Segment Overrides, create a new override.
  3. Enter a dummy trait & value.
  4. Click OR and delete the ORed condition immediately without modifying it.

Expected behavior

OR button should appear on the first condition and the flag should be saved.

Screenshots

OR button disappearing:

Screen.Recording.2024-01-05.at.09.25.09.mov

Rule failing to update:

Screen.Recording.2024-01-05.at.09.02.46.mov

How are you running Flagsmith?

  • Self Hosted with Docker
  • Self Hosted with Kubernetes
  • SaaS at flagsmith.com
  • Some other way

Additional context

Captured from network tab, seems like those conditions are still included in the request

{
  "description": "",
  "name": "sa",
  "project": 14554,
  "rules": [
    {
      "id": 83757,
      "type": "ALL",
      "rules": [
        {
          "id": 83759,
          "type": "ANY",
          "rules": [],
          "conditions": [
            {
              "id": 384088,
              "operator": "EQUAL",
              "property": "6",
              "value": "8",
              "description": null
            },
            {
              "id": 384087,
              "operator": "EQUAL",
              "property": "3",
              "value": "4",
              "description": null
            },
            {
              "operator": "EQUAL",
              "property": "5",
              "value": "7",
              "delete": "true"
            }
          ]
        },
        {
          "id": 83758,
          "type": "ANY",
          "rules": [],
          "conditions": [
            {
              "id": 384086,
              "operator": "EQUAL",
              "property": "1",
              "value": "2",
              "description": null,
              "delete": "true"
            }
          ],
          "delete": true
        },
        {
          "conditions": [
            {
              "operator": "EQUAL",
              "property": "",
              "value": "",
              "delete": "true"
            },
            {
              "operator": "EQUAL",
              "property": "",
              "value": "",
              "delete": "true"
            }
          ],
          "rules": [],
          "type": "ANY",
          "delete": true
        },
        {
          "conditions": [
            {
              "operator": "EQUAL",
              "property": "",
              "value": "",
              "delete": "true"
            },
            {
              "operator": "EQUAL",
              "property": "",
              "value": "",
              "delete": "true"
            }
          ],
          "rules": [],
          "type": "ANY",
          "delete": true
        }
      ],
      "conditions": []
    }
  ],
  "id": 23863,
  "uuid": "0cefcfd0-8988-4a30-bd8e-4ea45e4df216"
}

Note this wasn't the case when I typed the condition atribute, value and proceeded to delete it. It did not appear in the payload.

@Dogacel Dogacel added the bug Something isn't working label Jan 5, 2024
@dabeeeenster dabeeeenster added the front-end Issue related to the React Front End Dashboard label Jan 5, 2024
@MatheusLasserre
Copy link
Contributor

MatheusLasserre commented Jan 10, 2024

Can i make a PR for this one?

@kyle-ssg
Copy link
Member

Hey @MatheusLasserre, sure! I do think I know the issue as I was just checking it.

The api requires sending up deleted conditions with delete:true where the condition already had an id, however it still seems to require validation of other fields. There are therefore 2 scenarios that seem to cause this happening

  • Deleting a condition that had no operator/trait/value
  • Deleting required fields from an existing condition then removing the condition entirely

@kyle-ssg
Copy link
Member

@MatheusLasserre, if you're to look at this I think the conclusion is that we just set the property / value to "deleted" on the frontend to prevent both scenarios.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working front-end Issue related to the React Front End Dashboard
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants