Page data processors #20092
Unanswered
freiksenet
asked this question in
Ideas / Feature Requests
Replies: 1 comment
-
Alternatively @vladar suggested that it could be a directive. {
imageSharp {
fluid(...someParams) @asComponent {
...SomeFragment
}
}
}
mdx {
content @asComponent
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
GraphQL allows custom scalars. However page data only allows json serializable data. It would be convinient to enable defining processors for page-data that convert the data to a richer format. That would help for types like
Date
but also for future features like Renderable (#18976).This can be done by defining a client resolve function. Those functions would be included in the common bundle and called when a certain type is encountered in page-data.json. For instance for a backwards compatible date type it could be as follows:
And for Renderable type in could run a require on the value and return a component export.
Beta Was this translation helpful? Give feedback.
All reactions