[wp-trac] [WordPress Trac] #47375: Blocks API: Add server-side `serialize_block()`
WordPress Trac
noreply at wordpress.org
Fri Sep 20 18:19:54 UTC 2019
#47375: Blocks API: Add server-side `serialize_block()`
--------------------------------------+------------------------------
Reporter: dmsnell | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Editor | Version: trunk
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests | Focuses:
--------------------------------------+------------------------------
Comment (by dmsnell):
@jorgefilipecosta thanks for adding in the comments and updating the
patch. I'm back and can readdress this ticket now.
I'm nervous when I see us returning an empty string for invalid inputs. In
the JavaScript side we already have the problem that if a block somehow
fails during the parsing step it can mysteriously disappear. I'd rather
return `null` or throw an exception so that the caller can have better
signaling that something failed, so that a developer can quickly see if
they made a typo or mistake in sending in their block. Silently hiding
failures is something I've seen come back and bite us too often.
Thoughts?
Also, what if we split out the type-checking into its own function. Seems
like that might be usable in other places too.
If we like these ideas I can submit a new version of the patch soon.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/47375#comment:12>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list