I’m getting a lot of this:
warning Calling PlasmicComponentLoader.registerSubstitution() after Plasmic component has rendered; starting over.
What does it mean? Should I fix this somehow? I’m using Plasmic with Gatsby
I’m getting a lot of this:
warning Calling PlasmicComponentLoader.registerSubstitution() after Plasmic component has rendered; starting over.
What does it mean? Should I fix this somehow? I’m using Plasmic with Gatsby
Hello @spicy_lamprey. We recommend adding your component substitution in the plasmic-ini.ts
file, in the initPlasmicLoaderWithRegistrations
function that initiates the loader. Can you check if the code substitution is being done this way please?
So in plasmic-init.ts I have
export function initPlasmicLoaderWithRegistrations(plasmicOptions: InitOptions) {
// component registration here
}
And then I have 4 Gatsby pages using plasmic components:
• defaultPlasmicPage (this is basically copy pasted from docs and works as expected)
• 3 other pages where I use Plasmic components. I’ll paste some of the Plasmic relevant code here:
import React from 'react';
import { PlasmicComponent, PlasmicRootProvider } from '@plasmicapp/loader-gatsby';
...
import { initPlasmicLoaderWithRegistrations } from '../plasmic-init';
export const query = graphql`
query {
plasmicComponents(componentNames: ["ArticleTemplate", "Button"])
plasmicOptions
}
`;
const PlasmicArticlePage: React.FunctionComponent<Props> = ({ data, pageContext }) => {
const { plasmicComponents, plasmicOptions } = data;
...
return (
<PlasmicRootProvider
loader={initPlasmicLoaderWithRegistrations(plasmicOptions)}
prefetchedData={plasmicComponents}
>
{ /* other stuff here */ }
</PlasmicRootProvider>
);
}
export default PlasmicArticlePage;
Now whenever I navigate on the site I get that warning, I think it might be because I run initPlasmicLoaderWithRegistrations
on each page - but if I don’t run it on each page that I will for example not have my NavBar (It’s a code component that’s used by the ArticleTemplate
component)
Should I instead run the initPlasmicLoaderWithRegistrations
on some other level? TBH I’m not really sure if this is an issue but ofc warnings in console never look good
PS. Maybe I shouldn’t post on Friday considering the time zone difference from Finland