Can you use extractPlasmicQueryData and prefetcheQueryData with PlasmicRootProvider from react-web package?

Is it possible to use extractPlasmicQueryData and prefetchedQueryData with the PlasmicRootProvider from the react-web package?

Have a codegen’d app running on Next.js where I would like to provide SSR at the component level. I have got it working with the PlasmicRootProvider from loader-next, but this seems to break the Studio Canvas rendering while using Code Components.

Tried to switch the loader to the ‘react-web’ one but found out two things:
react-web doesn’t export extractPlasmicQueryData
react-web PlasmicRootProvider doesn’t seem to care about what it receives as prefetchedQueryData, so the data from the plasmic-query never arrives

Thanks for reporting @working_tuna! We’ll dig into this - we should be able to support this in core

For now, you can just write your own extractPlasmicQueryData() , as shown here, so you can be unblocked - @inclined_boar is our resident expert on this!

https://gist.github.com/yang/19d3418128e7ee923d4e415d1a2aa3a1

@yang thanks for the quick response! Will give this a try

@inclined_boar Giving this a try, curious if the prepass that is to be used is from the react-ssr-prepass package? I have got something working very similarly to the gist, but it is failing to find any queries on the prepass (cache comes out empty)

Thanks a lot for the Gist btw!

hi @working_tuna! yes, it should be react-ssr-prepass :thinking_face: are you using nextjs with codegen? Can you share your project ID with me so I can take a look? (feel free to DM)