textSerializers
in generateText
don't override renderText
set in schema
#3538
Labels
Type: Bug
The issue or pullrequest is related to a bug
What’s the bug you are facing?
Providing
textSerializers
togenerateText
does not override therenderText
function defined in the schemaWhich browser was this experienced in? Are any special extensions installed?
Chrome, no special extensions
How can we reproduce the bug on our side?
Provide a custom
renderText
in your schema:Call
generateText
and pass in a customtextSerializer
for the node:Expected behavior: the text returned in the text serializer should be output when calling
generateText
Can you provide a CodeSandbox?
Yes! https://codesandbox.io/s/infallible-keldysh-tf1ldm?file=/src/App.js
What did you expect to happen?
The
textSerializers
provided togenerateText
would override therenderText
function defined in the schema.In fact, this seems to be the expected behavior laid out in the PR that introduced the
generateText
method - the PR description says:usage of
generateText()
Note the "overwrite
renderText
method of nodes" comment right beforetextSerializers
Anything to add? (optional)
I believe this is just a matter of switching the order of these 2 lines:
so that the text serializers from the schema get added first, and then any custom text serializers overwrite the default ones in the schema.
Did you update your dependencies?
Are you sponsoring us?
The text was updated successfully, but these errors were encountered: