Rich Text (Blocks) - should save as NULL if no text length is 0 #23309
Labels
issue: bug
Issue reporting a bug
severity: low
If the issue only affects a very niche base of users and an easily implemented workaround can solve
source: core:content-manager
Source is core/content-manager package
status: pending reproduction
Waiting for free time to reproduce the issue, or more information
version: 4
Issue related to v4
version: 5
Node Version
20.9.0
NPM/Yarn/PNPM Version
Yarn 1.22.19
Strapi Version
5.8.1
Operating System
Linux (Other)
Database
PostgreSQL
Javascript or Typescript
Typescript
Reproduction URL
No response
Bug Description
Rich Text (Blocks) is saving as a object
[{"type": "paragraph", "children": [{"text": "", "type": "text"}]}]
when there is no text in the field.Steps to Reproduce
Expected Behavior
When I clear the blocks field, remove all text in the field, it should store it as NULL value.
Logs
Code Snippets
if the slogan is stored as NULL after its updated--cleared out- I wouldn't need the else statement at line 18 nor have the extensive check. Also if there are two arrays inside the children object, it would be printed out twice.
Media
screenshot from the postgresdb, left has text where the right doesnt- but still stored as object.
DOM inspect, the length value could be used to determinate if the field should be stored as object or NULL?
Additional information
No response
Confirmation Checklist
The text was updated successfully, but these errors were encountered: