Skip to content

Handle empty Canvas data in Renderer#29

Open
tbreeze-zengenti wants to merge 2 commits into
contensis:mainfrom
tbreeze-zengenti:null-check-utility
Open

Handle empty Canvas data in Renderer#29
tbreeze-zengenti wants to merge 2 commits into
contensis:mainfrom
tbreeze-zengenti:null-check-utility

Conversation

@tbreeze-zengenti
Copy link
Copy Markdown
Contributor

When working with Canvas fields, the API may return different forms of "empty" data:

  • null, or
  • an array of Block objects where the value field is an empty array []

Previously, consumers of the Canvas React Renderer had to implement their own checks to guard against these cases. Without these checks, rendering could fail or lead to unintended behavior. This inconsistency has also led to multiple internal utilities being created to sanitize the data before rendering.

The intention of this PR is to add a safeguard directly to the Renderer component to gracefully handle these edge cases.

@nflatley-zengenti
Copy link
Copy Markdown
Member

Hi Tim, thanks very much for bringing this issue to our attention and offering a patch that resolves the immediate issues you encountered

We have reviewed the change internally and we believe that patching the return value is likely to cause further issues downstream in other scenarios and as such will not be accepting this change as-is.

So we can isolate the root cause of the issue(s) can we instead have a copy of the raw Canvas JSON output that is causing the problem(s) during Render?

We can use this example to recreate the issue locally and give us the opportunity to find and fix the problem where it originates

@nflatley-zengenti nflatley-zengenti added canvas-react Issue relating to React render package bug Something isn't working needs clarification Requires additional context or clarification from the author labels Aug 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working canvas-react Issue relating to React render package needs clarification Requires additional context or clarification from the author

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants