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 get data out of a ListBlock of StreamBlocks #400

Open
Scotchester opened this issue Aug 27, 2024 · 0 comments
Open

Can't get data out of a ListBlock of StreamBlocks #400

Scotchester opened this issue Aug 27, 2024 · 0 comments

Comments

@Scotchester
Copy link

We are trying to access a ListBlock of StreamBlocks, and no matter how we try to query it, we can't get any data out of the StreamBlocks.

I don't have time to produce a reduced example today, but I wanted to go ahead and get this open to see if anyone else has experienced this. I suspected it might have something to do with this method only seeming to support a ListBlock of StructBlocks:

def resolve_items(self, info, **kwargs):
# Get the nested StreamBlock type
block_type = self.block.child_block
# Return a list of GraphQL types from the list of values
return [StructBlockItem(self.id, block_type, item) for item in self.value]

but absolutely nothing I change in that method alters the behavior of GraphQL. In fact, I can empty out the entire class and put in a dummy Graphene property, and the basic ListBlock of ButtonBlocks example from the docs still works fine!

class ListBlock(graphene.ObjectType):
    whatishappening = graphene.String()
    # items = graphene.List(graphene.NonNull(StreamFieldInterface), required=True)

    # class Meta:
        # interfaces = (StreamFieldInterface,)

    # def resolve_items(self, info, **kwargs):
        # Get the nested StreamBlock type
        # block_type = self.block.child_block
        # Return a list of GraphQL types from the list of values
        # return [StructBlockItem(self.id, block_type, item) for item in self.value]

So, I am very confused about what is going on there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant