Skip to content

how to correctly access nested fields #277

Closed as not planned
Closed as not planned
@MartinConde

Description

@MartinConde

I feel like I'm missing something obvious but after not being able to figure it for a while, I figured I'd ask here.
I have some nested blocks, which when using the "regular" sdk, I can get like so:

...
fields: [
  "*",
  {
    blocks: [
      "collection",
      {
        item: {
          block_hero: ["*"],
          block_intro: ["*"],
          block_cards: ["*"],
          block_image: ["*"],
          block_gallery: ["*.*"],
        },
      },
    ],
  },
];

However when I try to do the same thing using this module and following the useAsyncData example in the docs, it doesn't return any of the blocks, only the first set of "first-level" fields that it grabs using '*'.`
Doing something like

fields: ['*.*.*.*']

does return everything but I'd just like to figure out how to properly return the selected data.

Any pointers on what I might be missing to get this working would be much appreciated!

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions