question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

loadFromJsonLogic not working for multi-nested group fields

See original GitHub issue

In my fields config, I have an “owner” group and with an email subfield.

{
  owner: {
      subfields: {
        email: {
          label: 'Email',
          type: 'text',
          valueSources: ['value'],
        }
      },
      label: 'Owner',
      type: '!group',
  },
}

When I use getTree(loadFromJsonLogic({ or: [{ '==': [{ var: 'owner.email' }, '123'] }] }, config)), I get the following string and the query builder does not get populated correctly image

{
   "type":"group",
   "id":"988a9a8a-cdef-4012-b456-7171130265c3",
   "children1":{
      "899babaa-0123-4456-b89a-b171130265c2":{
         "type":"rule",
         "properties":{
            "field":"owner.email",
            "operator":"equal",
            "value":[
               "123"
            ],
            "valueSrc":[
               "value"
            ],
            "valueType":[
               "text"
            ]
         }
      }
   },
   "properties":{
      "conjunction":"OR",
      "not":false
   }
}

Shouldn’t the “type” in the above JSON be “rule_group” instead of “rule”?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
ymittalcommented, Jun 13, 2020

Oh definitely, sorry I think my Sandbox link didn’t get updated. Here’s the updated link with the issue - https://codesandbox.io/s/eager-architecture-ojqjf?file=/src/demo/demo.tsx

Notice how when there’s only one rule, the groups are not populated properly. Instead of user > details > login, I see user.details > login. image

0reactions
ukrbublikcommented, Jun 13, 2020

@ymittal I see some visual issues with nested groups:

  1. if you delete last rule, the group will remain in UI without a delete button
  2. second ‘+’ button is not visible on hover The issue should be opened for that.

But what issue with loading from json-logic you have? If you mean duplication of “user.details.login == ‘asadas’”, I don’t consider this as issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

loadFromJsonLogic not working for multiselect operators #386
I create config with the following field: { "tagId": { "label": "Tag", "type": "select", "fieldSettings": { "listValues": [ { "value": 1, ...
Read more >
Field group not working in Form displays [#2923308] - Drupal
If fields are grouped within the form display of a content type, it displays the hierarchy correctly within the manage content types view, ......
Read more >
applying the same location for multiple acf-groups - Stack ...
Group of fields for both (page and custom post type). Here is my current not working configuration for setting locations for these three...
Read more >
Group Field | Form Designer | User Guide | Epi Info - CDC
A Group field is a way to group together one or more fields on a page for visual and practical purposes. Visually, a...
Read more >
Create a grouped or summary report - Microsoft Support
Access makes working with grouped reports easy. ... When applying grouping, Access moves the grouping field to the leftmost column, and groups the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found