Closed SabineJakubinek closed 10 months ago
Hi, is it possible that the useflags hook depends on some react context being available? That would be my initial suspicion, maybe it is trying to read some react context that is not being provided and thus is null.
You would need to provide the context wherever the extract plasmic query data function is being invoked. What's going on is it is trying to pre-render the react tree here, so you just need to specify a react tree that renders correctly, including any necessary context providers. The default nextjs quick start just renders the plasmic root provider and Plasmic component inside of the pre-rendering phase.
Please let me know if that helps / if that is the issue!
Hi!
I think I did everything right in this matter. Maybe you can have a look in my repo here?
Hi, that does seem to be the issue.
In the catchall page, the rendering function renders within the wrappers provided by _app.tsx, which has a FlagsmithProvider.
But this is not being provided within getStaticProps during pre-rendering to the extractPlasmicQueryData.
Please let me know if this makes sense!
Thank you so much! This did the trick!
We would like to use Flagsmith with Plasmic and SSR. When running "yarn build" I get the following error:"Generating static pages (0/1)PLASMIC: Encountered error when pre-rendering TweetsProvider: TypeError: Cannot read properties of null (reading 'getValue')"
This is my code for testing, which is mostly from the documentation of Plasmic.
If I comment the four lines after "export function" everything is working fine. But with them the
console.log("Fetching tweets...");
doesn't appear and instead the error comes up. It seems like theusePlasmicQueryData
skips the whole arrow function.