You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To Reproduce
Try rendering a content item that has content JS that uses ref or ref.ref with a v2 SDK.
Expected behavior
I should be able to access the rendering component for the content with ref or the component's DOM node with ref.ref.
Screenshots
N/A
Additional context
Is ref and ref.ref only available in the React SDK? It's never been officially documented, even though it's a common (if advanced) use case. There needs to be a standardized way to access the component container in order to do DOM manipulations that can't be handled within the Visual Editor.
Describe the bug
The new v2 SDKs don't pass a variable representing the framework component content JS scope (i.e.,
ref
in the old React SDK), nor a variable for accessing the component's DOM element (i.e.,ref.ref
in the old React SDK). See https://github.com/BuilderIO/builder/blob/08a5a8d7cfb9612651d2b71839968be2d5da2f7f/packages/sdks/src/functions/evaluate.ts#L49C9-L62. Attempting to accessref
orref.ref
from within content JS while running a v2 SDK results in an error.To Reproduce
Try rendering a content item that has content JS that uses
ref
orref.ref
with a v2 SDK.Expected behavior
I should be able to access the rendering component for the content with
ref
or the component's DOM node withref.ref
.Screenshots
N/A
Additional context
Is
ref
andref.ref
only available in the React SDK? It's never been officially documented, even though it's a common (if advanced) use case. There needs to be a standardized way to access the component container in order to do DOM manipulations that can't be handled within the Visual Editor.I created an open source library that contains a helper for working with
ref
: https://github.com/buildquick/buildquick/tree/main/packages/builder-utils#waitforrefelement. I'm concerned that it won't work anymore with the v2 SDKs and that my clients' sites will stop functioning correctly once they eventually upgrade.The text was updated successfully, but these errors were encountered: