refine icon indicating copy to clipboard operation
refine copied to clipboard

[BUG] Inferencer relationInfer issue with accessor key

Open rasitcolakel opened this issue 2 years ago • 1 comments

Describe the bug

I override the field tags with field fieldTransformer

    {
        key: "tags",
        type: "relation",
        relation: true,
        multiple: true,
        resource: { name: "tags", route: "/tags" },
        relationInfer: {
            accessor: "name",
        },
        accessor: "id",
    },

And If the record's tag array does not have any item, the next records on the list does not mapped with the accessor key.

{
  "id": 1,
  "title": "1111123dasdasd",
  "content": "adasdasdasd",
  "published": true,
  "authorId": null,
  "categoryId": 2,
  "tags": [
    
  ],
}

Screenshot 2023-06-10 at 14 29 54

Also on the show page, it says "not-handled - relation with multiple but no resource"

Screenshot 2023-06-10 at 14 32 00

Steps To Reproduce

To solve this I have made some changes to the file while debugging

.../packages/inferencer/src/inferencers/mui/show.tsx

.../packages/inferencer/src/use-relation-fetch/index.ts

Expected behavior

When the array of a key does not have any item, it should show empty view.

Screenshot

No response

Desktop

No response

Mobile

  • UI Framework: MUI

Additional Context

No response

rasitcolakel avatar Jun 10 '23 11:06 rasitcolakel

Hi, @BatuhanW,

I created a PR to solve this issue. You can check it here #4498

rasitcolakel avatar Jun 12 '23 14:06 rasitcolakel