"index.js:179 Uncaught TypeError: Cannot destructure property 'blockType' of 'row' as it is undefined."
@jmikrut Sorry for ping, but I'm worried I broke something...is it possible my payload install is behind?
This is on the admin side, adding a Block to a collection
The page goes blank and prints that error
I'm on
"payload": "^1.3.0"
import { Block, CollectionConfig } from "payload/types";
const BannerBlock: Block = {
slug: "Banner",
fields: [
{
name: "section",
type: "text",
required: true,
},
{
name: "title",
label: "Image Banner Title",
type: "text",
required: true,
},
{
name: "subtitle",
label: "Image Banner Sub-Title",
type: "text",
required: true,
},
{
name: "image",
type: "upload",
relationTo: "media",
required: true,
},
],
};
const PanelBlock: Block = {
slug: "Panels",
fields: [
{
name: "section",
type: "text",
required: true,
},
{
name: "panels", // required
type: "array", // required
label: "Content Panels",
minRows: 1,
maxRows: 4,
labels: {
singular: "Panel",
plural: "Panels",
},
fields: [
{
name: "title",
type: "text",
required: true,
},
{
name: "content",
type: "textarea",
},
{
name: "link",
type: "text",
},
{
name: "icon",
type: "text",
},
],
},
],
};
const Pages: CollectionConfig = {
slug: "pages",
access: {
read: () => true,
},
admin: {
useAsTitle: "title",
},
fields: [
{
name: "title",
label: "Page Title",
type: "text",
required: true,
unique: true,
},
{
name: "description",
label: "Page Description",
type: "textarea",
required: true,
},
{
name: "layout", // required
type: "blocks", // required
minRows: 1,
maxRows: 20,
blocks: [BannerBlock, PanelBlock],
},
],
};
export default Pages;
what is the Payload version that you actually have installed?
i would also try and use these exact field configs in a brand-new and empty Payload project created with
npx create-payload-app
, to see if the problem persists
this seems like a data problem, maybe you have docs that are out of date or similar. but if you can create this issue with a new / blank project, using these exact field / block definitions, then it would appear to be a bug and we can help look at this immediately
@jmikrut Thanks my friend!
@jmikrut Sadly updating did not fix the issue :/
I had a block before, "SliderBlock"
I renamed it, changed its schema a bit
To BannerBlock
updated the collection config
But now I can add blocks to the collection
cant*
ahhh ok, if you renamed it, you should write a migration script to go through all your old docs, find any instances of the old block slug, and update them to the new block slug
I'm not sure how to do that
I figured it would take care of that kind of thing for me :X
i believe there are some examples in our GitHub discussions about quick migration scripts
but yeah, migrations are manual as with most every ORM. We don't change your existing data ever for you, at least not yet
With prisma i can just do like prisma migrate dev --name
it would be nice to do prisma migrate
err payload migrate
and have it do that kind of thing
that could very well be a thing that we build in the future
when i get financially stable enough ill quit my job and join payload
😛
well, the good news there is that we will be prioritizing hiring future engineers straight from our community 😈
hehe amazing
My speciality is more like webgl / 3d stuff
But I do enjoy this kind of dev
TBH, I was looking at some other headless cms systems last night
And it's really rough out there
Payload is the only one who's marketing doesnt automatically make me feel like they just want all my $$$$$
And ive tried like, 7 of them
That and it works nicely
I mean not that you guys dont wnat $ but
you care about the community
etc
anyway, ill let you get back to it
TY 😄
Star
Discord
online
Get help straight from the Payload team with an Enterprise License.