Skip to content
Discussion options

You must be logged in to vote

Hi @Stupidism, Good question!

Suppose you are working on a field hook that needs to use field data in a nested structure that repeats, like the array or blocks fields. If you had to do this with only the data at the top of the document you would have a terrible time traversing from the top to the correct index and nested field.

It sounds like this is an opportunity to improve our docs.

Here is a simplified example of a collection config where this is apparent:

const fields = [
  {
    type: 'array',
    name: 'top',
    hooks: {
      afterRead: [
        ({ data, siblingData }) => {
          // data and siblingData are the same at the top, so this one doesn't help
        },
      ],
    }

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Stupidism
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants