I installed the Sitecore 10.4 with Headless SXA and I noticed a strange behavior. On the components which has a "Component GraphQL Query" this field is ignored. On a 10.3 solution Link List component works fine on Experience Editor and on Next.js
On Experience editor I see:
On Next.js app I see the right content:
This is the code from the default installation for LinkList SXA component:
if (datasource) {
const list = datasource.children.results
.filter((element: ResultsFieldLink) => element?.field?.link)
.map((element: ResultsFieldLink, key: number) => (
<LinkListItem
index={key}
key={`${key}${element.field.link}`}
total={datasource.children.results.length}
field={element.field.link}
/>
));
return (
<div className={styles} id={id ? id : undefined}>
<div className="component-content">
<Text tag="h3" field={datasource?.field?.title} />
<Text tag="h3" field={datasource?.field?.title2} />
<ul>{list}</ul>
</div>
</div>
);
}
return (
<div className={styles} id={id ? id : undefined}>
<div className="component-content">
<h3>Link List</h3>
</div>
</div>
);
This is the Nextjs Component definition
export const Default = (props: LinkListProps): JSX.Element => {
const datasource = props.fields?.data?.datasource;
and the problem looks to be datasource is null on Experience Editor which doesn't make any sense.