StructuredText retro-compatibility when adding a new block

Hi there!

I am working with react-native and using the StructuredText component you provide.

  1. I released mobile apps that support StructuredText with a block of type A
  2. A few weeks later, I want to add a block of type B to StructuredText
  3. For old app versions that does not fetch block B in their graphql query, I have this crash The Structured Text document contains a ‘block’ node, but cannot find a record with ID 146357494 inside data.blocks!

What’s the recommended way to support adding a new block without breaking all previous versions?

I can try to parse the DAST schema and remove blocks that the current app version does not support but Is there an other way?

It would help if the StructuredText component was not throwing in case a block is not found (which can be perfectly fine in my scenario)

Thanks a lot for your help :pray:

Hello @christophe.menager and welcome to the community!

If a block value is present inside a structured text, you must request also the “blocks” in the GraphQL query, and also provide a renderRule for that block.

Otherwise, the StructuredText component would not be able to render that block:

Since blocks are custom pieces of schema, we have no way of knowing how the user would like to map the structure of the block to HTML, so without a renderRule, and the blocks being requested through the GraphQL query, we can’t render the structured text if a block is present.

Thanks @m.finamor , I got an answer from the support in parallel and got the opportunity to give a bit more details.

Your answer is the same pre-written question than your colleague, that is not answering my problem by the way :frowning_face:

I will create a feature request for an “Ignore unsuported blocks option” in the StructuredText component

Recap of my situation for others reading this question:

In my situation:

  1. I don’t fetch the block in my graphql query
  2. I don’t handle that block in the renderRule
  3. I simply want to NOT handle this unsupported block and not return it

Hello @christophe.menager, i’m the same person that replied over to you over at thats why the answers are equal, sorry :sweat_smile:
I’ve added the feature request to the roadmap and we’ll make sure to update you on any new developments