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

[Next.js] [XMC] Fix "Could not resolve site for name" error on XMC rendering host build #1659

Merged
merged 3 commits into from
Nov 9, 2023
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
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,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