Skip to content

Fix draft assets error#248

Merged
rosemcc merged 3 commits into
masterfrom
fix-draft-assets-error
Mar 13, 2022
Merged

Fix draft assets error#248
rosemcc merged 3 commits into
masterfrom
fix-draft-assets-error

Conversation

@rosemcc
Copy link
Copy Markdown
Contributor

@rosemcc rosemcc commented Mar 9, 2022

Description

This PR contains a fix for a bug where pages that are published with a link to a draft asset or a link to a page with a draft asset would not load, and would be directed to /error/500. The error is an internal server error from the graphql API and is classed as a 'Query execution error'. Because data is still returned for the page in question, the page should still load, albeit with some missing data (the draft asset will show as null in the returned data), and the error should be ignored. This would be very similar to how we currently handle draft linked entries - they are essentially ignored, and the page is still rendered, minus the draft entries.

Solution

In AppModule in te graphql client onError handler, there is now a check for the draft asset error: graphQLErrors[0].message.includes('Query execution error. Link from entry')
If this error occurs then it is ignored and the page will still load with whatever data has been returned from the server. Because the app already handles null values the UI should be still rendered correctly.

Screenshots

N/A

Testing

Manual testing for the following cases:

  • Draft asset is a banner image - in this case cards fall back to the default image, and page is rendered correctly but with no banner image
  • Draft asset is in the rich text body - page loads, image/document is not shown
  • Draft asset is in an expandable page part - page loads, image is not shown
  • Draft asset is a funding page application document - page loads, doc is not shown
  • Draft asset is the Home page banner image - page loads with a grey background in the banner instead of the image
  • Draft asset is an activity page image - page loads but with a white background section where the image would normally be

Have the changes been checked in the following browsers?

N/A

@rosemcc rosemcc requested a review from Trombach March 9, 2022 00:47
Copy link
Copy Markdown
Contributor

@Trombach Trombach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@rosemcc rosemcc merged commit 16c89fe into master Mar 13, 2022
@rosemcc rosemcc deleted the fix-draft-assets-error branch March 13, 2022 22:52
@rosemcc rosemcc mentioned this pull request Mar 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants