lsirivong / gatsby-plugin-modal-routing

A gatsby plugin for routable modals
44 stars 30 forks source link

Modal stops opening and goes direct to a new page when 'gatsby-source-prismic-graphql' is added to gatsby-config.js #23

Closed lalmachado closed 4 years ago

tolchai commented 4 years ago

In case anyone runs into this problem:

gatsby-plugin-modal-routing does work together with gatsby-source-prismic-graphql, but it seems it is necessary to avoid using

export const query = graphql`` 

It does work with StaticQuery so just use child components.

LucyMac commented 4 years ago

@tolchai thank you so much for that.

LucyMac commented 4 years ago

I later realised you can't pass variables such as $uid to staticQueries 😏 Solution for me was to load all of the data onto the page, instead of just the bit I needed, and then filter by the uid which is available through the pageContext. Seems a shame to have to do it that way but it works.

tolchai commented 4 years ago

@LucyMac yeah, had to deal with the same problem and solved it with the filter as well. Not ideal for sure 🙂 There is an interesting discussion on the subject here - https://github.com/gatsbyjs/gatsby/issues/10482

Another solution would probably be just to use gatsby-source-prismic instead.