wellcomecollection / wellcomecollection.org

🪟 Wellcome Collection's website and services that support it
https://wellcomecollection.org
MIT License
39 stars 5 forks source link

Prismic API; fetch Pages to use graphQuery instead of fetchLinks #10852

Closed rcantin-w closed 4 months ago

rcantin-w commented 5 months ago

pages/Wuw2MSIAACtd3StS started failing and getting flagged in the alerts channel.

After investigating, we believe the issue is caused by an event listed in that page's body's contentList. The event does not return any interpretations and that breaks the code. We believe this is due to using fetchLinks. As @gestchild found:

we're using fetchlinks to retrieve the data in fetchPage(). However, interpretations are a group and "Fetchlinks allows you to get a specific field and all its content from the document. You can't retrieve linked content from Slices and groups with fetchLinks. To retrieve content from the linked document in slices and groups, you need to use graphQuery (an advanced version of fetchLinks).

In prod, we have removed that event (Bodies of Knowledge Symposium) so users could access the page. It should be re-added once this is fixed. (See Slack convo)

rcantin-w commented 4 months ago

OK so this will be moved to Won't Do and I'm sorry that I can't give a proper explanation for what happened.

In prod, we have removed that event (Bodies of Knowledge Symposium) so users could access the page. It should be re-added once this is fixed. (See Slack convo)

It has now been re-added.

It seems that all it needed was a re-save in order to have access to its interpretations. It probably has something to do with the changes in the model and needing saving to use the new model, but we thought Migrating the content would cover that and maybe it doesn't.

The theory above was a good idea, but we realised it wasn't the problem as audiences and locations are also groups and are fetched by fetchLinks.

I tried modifying the model further, but really, the only thing that was needed was re-saving the document it seems.