[PF-498] Add normalization process for RichTextElement - #2965
Merged
stevestreza-ksr merged 2 commits intoAug 20, 2026
Conversation
amy-at-kickstarter
left a comment
Contributor
There was a problem hiding this comment.
This change looks good to me, but - based on the comment, it sounds like this logic should live on the server. Does Android have the same issue? Can we push this fix up to the server level, instead?
Contributor
Author
|
Confirming with Tony but I am reasonably sure that this is handled on Android. |
amy-at-kickstarter
approved these changes
Aug 19, 2026
stevestreza-ksr
deleted the
stevestreza/sdui-content/normalized-nesting
branch
August 20, 2026 06:45
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📲 What
This pull request does a normalization pass on RichTextElements converted from GraphQL so that nesting works properly with the elements we receive.
🤔 Why
The server has an internal HTML parser that converts an HTML element into a GraphQL type. These types can be nested. And due to the way the HTML parser works, that means elements like images can be added as children of a text node. But we need text and image nodes to be block-level nodes.
Example:
<div>Here's an image: <img ... /> Isn't it neat?</div>🛠 How
After converting the GraphQL elements to RichTextElements, we now have a function that scans all of the elements and replaces them with one or more "normalized" elements.
In the above example, the conversion turns that div into a Text block with three child elements [
Text,Photo,Text]. If this type of pattern is detected, the original element is removed and replaced with three standalone elements.The text nodes may also be empty (e.g. if the image is directly at the start or end of the block) so we filter out empty text blocks as well.