builder icon indicating copy to clipboard operation
builder copied to clipboard

builderContext is missing for Qwik

Open mhuretski opened this issue 1 week ago • 0 comments

Describe the bug In 0.14.27 builderContext is missing for Qwik.

provideBuilderContext works only with React Server Components and with default components. Our logic rely on qwik and custom components. Basically we define a schema on model level and use it everywhere inside custom components.

To Reproduce

import type { RegisteredComponent } from '@builder.io/sdk-qwik'
import type { BuilderContextInterface } from '@builder.io/sdk-qwik/types/src/context/types'

const CustomComponent = component$<{
  builderContext: BuilderContextInterface & {
    content?: {
      data?: {
        foo: string
      }
    }
  }
}>(({ builderContext }) => {
  const data = builderContext.content?.data // 0.14.27 Exception builderContext -> undefined
  if (!data) {
    return null
  }

  return <div>{data.foo}</div>
})

export const CustomComponentBuilder: RegisteredComponent = {
  component: CustomComponent,
  name: 'Custom Component',
}

Is there any new way how to get fields from model inside custom components?

mhuretski avatar Jun 29 '24 07:06 mhuretski