Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[templates/nextjs-sxa]: Title component has been fixed with missing value #SXA-7389 #1842

Merged
merged 2 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Our versioning strategy is as follows:
* `[templates/nextjs-sxa]` The banner variant of image component is fixed with supporting metadata mode. ([#1826](https://github.com/Sitecore/jss/pull/1826))
* `[sitecore-jss]` `[sitecore-jss-react]` DateField empty value is not treated as empty ([#1836](https://github.com/Sitecore/jss/pull/1836))
* `[templates/nextjs-sxa]` Fix styles of title component in metadata mode. ([#1839](https://github.com/Sitecore/jss/pull/1839))
* `[templates/nextjs-sxa]` Fix missing value of field property in Title component. ([#1842](https://github.com/Sitecore/jss/pull/1842))

### 🎉 New Features & Improvements

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const ComponentContent = (props: ComponentContentProps) => {
export const Default = (props: TitleProps): JSX.Element => {
const datasource = props.fields?.data?.datasource || props.fields?.data?.contextItem;
const { sitecoreContext } = useSitecoreContext();
const text: TextField = datasource?.field?.jsonValue;
const text: TextField = datasource?.field?.jsonValue || {};
const link: LinkField = {
value: {
href: datasource?.url?.path,
Expand All @@ -72,7 +72,7 @@ export const Default = (props: TitleProps): JSX.Element => {
};
if (sitecoreContext.pageState !== 'normal') {
link.value.querystring = `sc_site=${datasource?.url?.siteName}`;
if (!text.value) {
if (!text?.value) {
text.value = 'Title field';
link.value.href = '#';
}
Expand Down