Type error on CSUI

I copied and pasted the example (https://docs.plasmo.com/framework/content-scripts-ui/life-cycle#custom-renderer) of the docs and it's throwing errors. Anyone knows how to fix? (ignore the component error, it does not exist)
Plasmo Docs
Life Cycle of Plasmo CSUI – Plasmo
Plasmo's CSUI orchestrates a lifecycle dedicated to mounting and unmounting your React, Vue, or Svelte components in a content script.
8 Replies
lab
lab•14mo ago
Whoops, that's a bug in the typing and also within the docs @Mael just released 0.69.2 and also the docs update, pls check them out and lmk if it still doesn't work! Basically:
import type { PlasmoRender } from "plasmo"

const AnchorOverlay = ({ anchor }) => <span>{anchor.innerText}</span>

export const render: PlasmoRender = async (
{
anchor, // the observed anchor, OR document.body.
createRootContainer // This creates the default root container
},
_,
OverlayCSUIContainer
) => {
const rootContainer = await createRootContainer()

const root = createRoot(rootContainer) // Any root
root.render(
<OverlayCSUIContainer>
<AnchorOverlay anchor={anchor} />
</OverlayCSUIContainer>
)
}
import type { PlasmoRender } from "plasmo"

const AnchorOverlay = ({ anchor }) => <span>{anchor.innerText}</span>

export const render: PlasmoRender = async (
{
anchor, // the observed anchor, OR document.body.
createRootContainer // This creates the default root container
},
_,
OverlayCSUIContainer
) => {
const rootContainer = await createRootContainer()

const root = createRoot(rootContainer) // Any root
root.render(
<OverlayCSUIContainer>
<AnchorOverlay anchor={anchor} />
</OverlayCSUIContainer>
)
}
Mael
Mael•14mo ago
@louis Upgraded the version. Still getting the errors tho 🤔
lab
lab•14mo ago
restart the ts server too
Mael
Mael•14mo ago
lol, restarting VSCode worked. Thank you so much!
Mael
Mael•14mo ago
@louis just FYI I'm getting this error now
Arcane
Arcane•14mo ago
@Mael has reached level 2. GG!
Mael
Mael•14mo ago
also getting this unless I send the anchor down to the OverlayCSUIContainer component. anchor is still the html element and not the result of the getOverlayAnchor function (not sure if this is intended or not)
lab
lab•14mo ago
Ooh yeah - you need to send the anchor down as a props otherwise the built-in container will not work I think they are the same error, will update the docs on that as well
Want results from more Discord servers?
Add your server
More Posts
MUI Select component attachment point in CSUI?Just wondering if anyone else has ran into this and what the correct fix should be. Seems like for <help w/ mantine notificationsi've got mantine modals working in content.tsx but notifications don't seem to work, probably not moCSUI Styling React components without getStyle() on each componentLong time no see! I haven't been keeping up lately with Plasmo, I'm surprised with how much it has cBest way to use `useStorage` with `SecureStorage`?Looking at setting up useStorage hooks for SecureStorage items. Are there preferred ways of handlingSeeing an error `The "path" argument must be of type string. Received an instance of Object`Trying to run `pnpm dev` Full error response is: ``` 🔴 ERROR | Build failed. To debug, run plasmoSend message from popup to cs and backI have something like: `content.ts` ```ts chrome.runtime.onMessage.addListener((_, __, sendResponse)vscode error opening .plasmo/static/common/*.tsx and .plasmo/static/common/*.ts fileshow do i fix these errors in .plasmo/static/content.tsx ``` [{ "resource": "/extensionname/.plasReact Components render twice?So I'm trying to split my code into components, but this ends in the component rendering twice on myCharging money with PayPalIs there a best practice for charging money with PayPal in a Chrome extension? The main reason I didHaving to add import react from "react" for each filei just made a new extension by git cloning my old one and just one small issue is that I have to add