Skip to content

Commit

Permalink
[Next.js] [XMC] Fix "Could not resolve site for name" error on XMC re…
Browse files Browse the repository at this point in the history
…ndering host build (#1659)

* Fix issue when prerendering 404/500 pages during build on XMC editing hosts

* Bump @sitecore/components to latest (1.1.2)

* CHANGELOG update
  • Loading branch information
ambrauer committed Nov 9, 2023
1 parent 11a8365 commit f4ff92a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Our versioning strategy is as follows:
### 🛠 Breaking Changes

* `[create-sitecore-jss]` The `nextjs-personalize` initializer add-on template has been removed and is replaced by the `nextjs-xmcloud` initializer template. You can use the interactive prompts or the `--xmcloud` argument to include this template. ([#1653](https://github.com/Sitecore/jss/pull/1653))
* `[templates/nextjs]` `[sitecore-jss-nextjs]` CloudSDK Integration ([#1652](https://github.com/Sitecore/jss/pull/1652)):
* `[templates/nextjs]` `[sitecore-jss-nextjs]` CloudSDK Integration ([#1652](https://github.com/Sitecore/jss/pull/1652)) ([#1659](https://github.com/Sitecore/jss/pull/1659)):
* Removed the following properties from _PersonalizeMiddleware_: _getPointOfSale_, _clientKey_, _endpoint_. You now need to provide _sitecoreEdgeContextId_ as a replacement.
* _PersonalizeMiddleware_ has transitioned to utilizing the _CloudSDK_ package, replacing the previous dependency on _Engage_.
* Introduced _Context_ class, that is used to initialize the application Context and shared Software Development Kits (SDKs). Accessible within the _@sitecore-jss/sitecore-jss-nextjs/context_ submodule.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"dependencies": {
"@sitecore/components": "^1.1.0",
"@sitecore/components": "^1.1.2",
"@sitecore-cloudsdk/events": "^0.1.1",
"@sitecore-feaas/clientside": "^0.4.12"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
import { SitecorePageProps } from 'lib/page-props';
import { context } from 'src/lib/context';
import { siteResolver } from 'lib/site-resolver';
import config from 'temp/config';

/**
* The Bootstrap component is the entry point for performing any initialization logic
* that needs to happen early in the application's lifecycle.
*/
const Bootstrap = (props: SitecorePageProps): JSX.Element | null => {
const site = props.layoutData?.sitecore.context.site;
const siteInfo = siteResolver.getByName(site?.name || config.siteName);

/**
* Initializes the application Context and associated Software Development Kits (SDKs).
* This function is the entry point for setting up the application's context and any SDKs that are required for its proper functioning.
* It prepares the resources needed to interact with various services and features within the application.
*/
context.init({ siteName: siteInfo.name });
context.init({ siteName: props.site?.name || config.siteName });

return null;
};
Expand Down

0 comments on commit f4ff92a

Please sign in to comment.