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

Async afterRead field hook in Block inside lexical does not use returned value #10700

Open
andershermansen opened this issue Jan 21, 2025 · 0 comments
Assignees
Labels

Comments

@andershermansen
Copy link
Contributor

Describe the Bug

Creating a block with a field with async afterRead will not update output when used inside a lexical richtext.
When the same block is used inside a block field it works as expected.

My reproduction contains two fields inside a block: test1 and test2. They both have an afterRead which puts the value to upper case, test1 is a normal function and test2 runs an async function.

Testing with block

When used as in a block field I do this input:

Image

And then after saving and it's read back I get this output (which is correct):

Image

Testing with lexical

Using the same block inside lexical field I get a difference.

This is my input:

Image

But after saving and reading back I get this output (where I expected both fields to be uppercase):

Image

Link to the code that reproduces this issue

https://github.com/andershermansen/payload-afterread-reproduction

Reproduction Steps

  1. Go to collection Lexical
  2. Create new
  3. In the richtext field add a new "Test block"
  4. Enter some text in the two text fields in the block
  5. Hit save

Actual:
First text field is upper case, second text field is lower case

Expected:
Both text fields to be upper case

Which area(s) are affected? (Select all that apply)

area: core, plugin: richtext-lexical

Environment Info

payload: 3.18.0
node: 22.13.0
next: 15.1.5
@andershermansen andershermansen added status: needs-triage Possible bug which hasn't been reproduced yet validate-reproduction labels Jan 21, 2025
@AlessioGr AlessioGr self-assigned this Jan 22, 2025
@AlessioGr AlessioGr added the plugin: richtext-lexical @payloadcms/richtext-lexical label Jan 22, 2025
@github-actions github-actions bot removed the status: needs-triage Possible bug which hasn't been reproduced yet label Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants