const inEditor = React.useContext(PlasmicCanvasContext)
returns false
for both the editor and on the app, when used in _app.tsx. We’re embedding some scripts we don’t want to embed in Plasmic Studio. Which is the best way to do it?
That doesn’t seem right…when you do try that from a brand-new create-plasmic-app, are you seeing the same issue? It may be due to an outdated package, that’s a wild guess
If your component is in _app.tsx, unfortunately there’s no way for it to detect that it’s in PlasmicCanvas via React.useContext(PlasmicCanvasContext) (because it is rendered outside of <PlasmicCanvasHost/>
One ugly hack you can try is to check window.location.hash
for canvas=true
to see if you’re in an artboard or not
I have some other hacks I can try for my particular nuance right now. But all I want is to not load some scripts and embeds in Studio, which I would like to use universally otherwise. Perhaps this could be added to a feature requests. This can cause weird analytics data when scripts and pixels are embedded this way.