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

Error when saving the same content #74

Closed
joostvanhoof opened this issue Jul 18, 2022 · 7 comments · Fixed by #77
Closed

Error when saving the same content #74

joostvanhoof opened this issue Jul 18, 2022 · 7 comments · Fixed by #77
Labels
bug Something isn't working

Comments

@joostvanhoof
Copy link

@roelofr this might be related to this issue because it's trying to save [object Object] again.

What's happening is that when I have an empty EditorJS field in Nova and type some content and save it, everything works fine.

If I then edit the resource and hit save but don't edit the content, I get:

3140 Invalid JSON text: "Invalid value." at position 1 in value for column 'post.body'. (SQL: update `posts` set `body` = [object Object], ...)

If I change the EditorJS content and save it (even if it's just adding a dot), then it does actually works.

@roelofr
Copy link
Collaborator

roelofr commented Jul 18, 2022

I still can't replicate this issue. Are you using the editor in a conditional field or something?

waelelsawy added a commit to waelelsawy/nova-editor-js that referenced this issue Jul 18, 2022
@johnpuddephatt
Copy link

I am also getting [Object object] saved in my database with 3.0.4 when updating an entry without changing the editorJs field's content.

This only happens when casting the attribute. I have the following in my model:

protected $casts = [
    "description" => NovaEditorJsCast::class,
];

If I remove this the problem goes away.

@roelofr roelofr added the bug Something isn't working label Jul 25, 2022
@joostvanhoof
Copy link
Author

@roelofr this bug is still there for me, for you as well @johnpuddephatt? There is this commit suggested which I think should fix it?

@roelofr roelofr mentioned this issue Aug 12, 2022
roelofr pushed a commit that referenced this issue Aug 12, 2022
@roelofr
Copy link
Collaborator

roelofr commented Aug 12, 2022

Fixed in v3.0.5

@joostvanhoof
Copy link
Author

@roelofr this bug is still there for me. If I don't change the content (because I've edited other fields) and then update the resource I still get the error message indicating it tries to save [object Object] as a value in the database.

@johnpuddephatt
Copy link

@roelofr this bug is still there for me, for you as well @johnpuddephatt?

Yes it's still there in 3.0.5 when I cast the field content with Advoor\NovaEditorJs\NovaEditorJsCast. Without the casting it does not occur.

@roelofr
Copy link
Collaborator

roelofr commented Aug 23, 2022

But can you easily cast the stored data to HTML without the cast?
The mixture of HTML and JSON is supposed to be solved by the cast.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants