I’m starting a project using Sanity and while doing the setup for Structure in localhost I found the following error:
Error: Component not defined: Code
This happens when I try to introduce a listItem inside another. This is an example of code used for the structure in ‘./structure/index.ts’, as said in the official guide.
export const structure = (S) =>
S.list()
.title('Base')
.items([
S.documentTypeListItem('profesorado').title('Profesorado'),
S.documentTypeListItem('departamento').title('Departamentos'),
S.listItem()
.title('Profesorado por departamentos')
.child(
S.listItem()
.title("aló")
.child(
S.documentTypeList('departamento')
.title('Profesorado por departamentos')
.child((departamentoId) =>
S.documentList()
.apiVersion('2024-06-01')
.title('Profesorado')
.filter('_type == "profesorado" && $departamentoId in departamento[]._ref')
.params({departamentoId}),
),
)
)
])```
I have reinstalled everything but it isn't working yet, the error is just the same.
New contributor
Darío Otero is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.