Comments (8)
sure, this is my builder file
import { RenderContent, getContent, isPreviewing } from "@builder.io/sdk-vue"
import Hero from "@/views/components/Hero.vue"
import NavBar from "@/views/components/NavBar.vue"
import MainFooter from "@/views/components/MainFooter.vue"
import VpsHeader from "@/views/components/VpsHeader.vue"
import { onMounted } from "vue"
const props = defineProps<{
slug: string
}>()
const BUILDER_PUBLIC_API_KEY = "my-api-key"
let canShowContent = ref(false)
let content = ref(null)
let title = ref(null)
let apiKey = ref(BUILDER_PUBLIC_API_KEY)
onMounted(() => {
getContent({
model: "test",
apiKey: BUILDER_PUBLIC_API_KEY,
userAttributes: {
urlPath: "/" + props.slug + "/",
},
options: { enrich: true },
}).then((res) => {
content.value = res
canShowContent.value = content.value || isPreviewing()
title.value = (content.value && content.value.data && content.value.data.title) || "Unpublished"
})
})
const REGISTERED_COMPONENTS = [
{
component: VpsHeader,
name: "Vps Header",
canHaveChildren: true,
inputs: [
{
name: "description",
type: "richText",
hideFromUI: false,
helperText: "This is an editable region.",
defaultValue: "<b>This text is bold</b>",
},
{
name: "image",
type: "file",
allowedFileTypes: ["jpeg", "jpg", "png", "svg", "webp"],
required: false,
defaultValue: "https://1gbits.com/build/assets/vps-hero-2f222f0f.svg",
},
],
},
{
component: Hero,
name: "Hero",
canHaveChildren: false,
},
{
component: NavBar,
name: "NavBar",
canHaveChildren: false,
},
{
component: MainFooter,
name: "MainFooter",
canHaveChildren: false,
},
]
const getRegisteredComponents = () => {
return REGISTERED_COMPONENTS
}
</script>
<template>
<Head>
<title>{{ title }}</title>
</Head>
<RenderContent
v-if="canShowContent"
model="page"
:content="content"
:api-key="apiKey"
:enrich="true"
:include-refs="true"
:customComponents="getRegisteredComponents()" />
<div v-else>Content not Found</div>
</template>
I'll try to make a minimum reproduction on github and let you know when its done!
from builder.
I've never setup a laravel project, but I see you're externalizing the SDK which makes no sense:
build: {
rollupOptions: {
external: ['@builder.io/sdk-vue'],
},
},
You need to remove that config
from builder.
Can you share the integration code for Builder.io in your repo? Can you share a minimum reproduction in github?
from builder.
@samijaber I've added you to the project test repo new1gbitstest
from builder.
Thanks for the quick fix! Removing that config did the trick for the bare specifier issue.
I realized I left that config in there from some previous testing. but now, the content isn't rendering as SSR. Any ideas on how to get SSR on track?
from builder.
I am not familiar with the inertiaJS stack, so I cannot tell you how/why SSR is not working in that techstack. However, Builder's SDK works in SSR by default without any additional configuration. So this would typically be an issue with how the server is configured.
If you still need help, please provide a more detailed explanation of what you're seeing.
from builder.
Got it, thanks for the heads up! In my setup, everything is rendering as SSR except the Builder.io RenderContent component. Seems like it's specific to that part.
when I disable the Javascript on browser
<div v-else>Content not Found</div>
is rendering instead of the contents.
from builder.
You are most likely not providing the correct URL path as an argument to the data-fetching function (getContent
/fetchOneEntry
). In SSR, you need to use whatever solution your router library offers to pass the path.
Refer to the Nuxt example:
see:
userAttributes: {
urlPath: route.path,
},
Closing this issue as the original error is resolved/
from builder.
Related Issues (20)
- Builder SDK Vue breaks after 0.12.4 (properties of null (reading 'isCE') HOT 2
- defineProps macro in vue 3 with TS (custom components) HOT 1
- `@builder.io/sdk-react-native` fails to render due to rendering a `div` in `DynamicRenderer` HOT 7
- How to give just simple array as prop HOT 2
- `$elemMatch` operator does not work in the new SDK HOT 5
- Types broke in Vue SDK after 0.12.8 HOT 3
- Is it possible to have dynamically created pages? HOT 1
- see image preview instead cloud icon HOT 2
- `npm run dev` error caused by `@builder.io/dev-tools`: package.json invalid path HOT 1
- sdk-react gen2 useContext HOT 7
- `npm run dev` "package.json invalid path" error caused by `@builder.io/dev-tools` HOT 3
- [Builder.io]: Failed code evaluation: Cannot read properties of undefined (reading 'Isolate') HOT 13
- Required rule doesn't work on field of type "file" if it's nested in object
- Custom component with many localized fields freezes entire Builder editor and throws many errors in console HOT 1
- Field of type "reference" restricted to specific model allows to choose entry of some random model HOT 1
- BUG: Builder Contentful Plugin Dynamic Data Binding Issue HOT 6
- Add a way to override fetch function in fetchEntries and fetchOneEntry
- `@builder.io/sdk-vue` is not properly reporting type declarations in `package.json`, causing type errors HOT 2
- Missing document for React SDK Gen 2 on `Adding editable regions to custom components` section of the docs HOT 2
- Conflict with options url.searchParams and enrich: true HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from builder.