You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Articles currently have duplicated <p> rendering in the body when there is a whitespace in the portable text payload. This <p> contains no text. This should be removed.
Platform & operating system
MacOS Sequoia 15.1.1 - M1
What browsers are you seeing the problem on?
Firefox, Microsoft Edge
Steps to reproduce
Navigate to any of our articles.
Inspect element.
Additional context
The text was updated successfully, but these errors were encountered:
I stumbled upon this GitHub thread discussing blank spaces appearing in the HTML tree when using Sanity portable text. The thread is discussing a react component, however its easily applicable to Svelte. See: Empty lines coreyward/react-portable-text#18 (comment)
I transformed the react code into Svelte code by observing the content returned by an article query and accessing the appropriate object and its values. There was already a hint in the component ArticleSingleComponentBlock.svelte, where it states:
let { value } = $derived(portableText);
let { style='normal' } = $derived(value);
There was also a value field in the object returned by the Sanity query.
That's it!
n30w
linked a pull request
Nov 28, 2024
that will
close
this issue
Description
Articles currently have duplicated
<p>
rendering in the body when there is a whitespace in the portable text payload. This<p>
contains no text. This should be removed.Platform & operating system
MacOS Sequoia 15.1.1 - M1
What browsers are you seeing the problem on?
Firefox, Microsoft Edge
Steps to reproduce
Additional context
The text was updated successfully, but these errors were encountered: