https://github.com/datocms/gatsby-source-datocms/issues/209 describe how sometimes nested fields don't honor locale settings. This happens because the context.sourceDatocms object is actually reused between all the queries that run in given process and state there is scope to just field paths within the query. Gatsby can execute multiple queries in parallel (especially for the builds as it does batching of all queries), so this shared state object is a problem as one query for one page might change the context that query for other page rely on.
Proposed fix provide fresh locale and localeFallback for each query seperately - I implemented this in shortest way possible, there is opportunity for some optimisation as right now there is a lot of repeated .get lookups which I kept for visibilty and easier to follow proposed changes
https://github.com/datocms/gatsby-source-datocms/issues/209 describe how sometimes nested fields don't honor
locale
settings. This happens because thecontext.sourceDatocms
object is actually reused between all the queries that run in given process and state there is scope to just field paths within the query. Gatsby can execute multiple queries in parallel (especially for the builds as it does batching of all queries), so this shared state object is a problem as one query for one page might change the context that query for other page rely on.Proposed fix provide fresh
locale
andlocaleFallback
for each query seperately - I implemented this in shortest way possible, there is opportunity for some optimisation as right now there is a lot of repeated.get
lookups which I kept for visibilty and easier to follow proposed changesPossibly fixes #209