-
Notifications
You must be signed in to change notification settings - Fork 59
Changes done for the new version of JSS #563
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR upgrades the Sitecore JSS application from version 21.5.3 to 22.9.0, implementing significant changes to align with the new JSS v22+ APIs and patterns.
- Updates all @sitecore-jss/* dependencies to ~22.9.0 and React to ^19.1.0
- Refactors GraphQL services to use the new clientFactory pattern instead of direct endpoint/apiKey configuration
- Updates FEAAS themes functionality and CDP integration to match new APIs
Reviewed Changes
Copilot reviewed 17 out of 19 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| package.json | Updates JSS dependencies to v22.9.0, React to v19.1.0, and adds new Sitecore Cloud SDK packages |
| lib/graphql-client-factory/ | Creates new GraphQL client factory implementation following JSS v22+ patterns |
| pages/api/ | Updates sitemap and robots APIs to use clientFactory and NativeDataFetcher |
| pages/404.tsx, pages/500.tsx | Refactors error page services to use clientFactory pattern |
| lib/page-props-factory/plugins/feaas-themes.ts | Updates FEAAS themes to use new getDesignLibraryStylesheetLinks API |
| lib/middleware/plugins/ | Updates middleware plugins to use clientFactory and new CDP configuration |
| components/CdpPageView.tsx | Replaces deprecated PosResolver with custom implementation |
| Various service factories | Updates layout and dictionary service factories to use clientFactory |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| props.headLinks.push( | ||
| ...getDesignLibraryStylesheetLinks( | ||
| props.layoutData, | ||
| process.env.SITECORE_EDGE_CONTEXT_ID || '' |
Copilot
AI
Sep 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The environment variable SITECORE_EDGE_CONTEXT_ID should not default to an empty string as this could cause the function to behave unexpectedly. Consider throwing an error or providing a proper fallback value if this environment variable is required.
| props.headLinks.push( | |
| ...getDesignLibraryStylesheetLinks( | |
| props.layoutData, | |
| process.env.SITECORE_EDGE_CONTEXT_ID || '' | |
| const contextId = process.env.SITECORE_EDGE_CONTEXT_ID; | |
| if (!contextId) { | |
| throw new Error('Environment variable SITECORE_EDGE_CONTEXT_ID is required but not set.'); | |
| } | |
| props.headLinks.push( | |
| ...getDesignLibraryStylesheetLinks( | |
| props.layoutData, | |
| contextId |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the change as suggested
| sitecoreEdgeContextId: process.env.NEXT_PUBLIC_CDP_CONTEXT_ID || '', | ||
| sitecoreEdgeUrl: | ||
| process.env.NEXT_PUBLIC_CDP_EDGE_URL || 'https://edge-platform.sitecorecloud.io', | ||
| channel: process.env.NEXT_PUBLIC_CDP_CHANNEL || 'WEB', | ||
| currency: process.env.NEXT_PUBLIC_CDP_CURRENCY || 'USD', |
Copilot
AI
Sep 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sitecoreEdgeContextId should not default to an empty string as this is likely a required configuration value for CDP functionality. Consider validating that this environment variable is set or throwing an error if it's missing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sitecoreEdgeContextId: process.env.NEXT_PUBLIC_CDP_CONTEXT_ID
? process.env.NEXT_PUBLIC_CDP_CONTEXT_ID
: (() => {
throw new Error(
'Environment variable NEXT_PUBLIC_CDP_CONTEXT_ID is required but not set.'
);
})(),
Updated
| const resolvePointOfSale = (site: SiteInfo, language: string): string => { | ||
| return `${site.name}_${language}`; | ||
| }; |
Copilot
AI
Sep 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The resolvePointOfSale function is defined inside the component which will cause it to be recreated on every render. Move this function outside the component or wrap it with useCallback to avoid unnecessary re-creations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Called the function outside of the component.
…pgrade-clean-branch
Upgrade Summary for The Task Assinged
JSS and React Version Upgrade
Updated all @sitecore-jss/* dependencies to ~22.9.0 in package.json.
Upgraded react and react-dom to ^19.1.0.
GraphQL Service Refactoring
Replaced direct usage of endpoint and apiKey with clientFactory for all GraphQL services:
GraphQLDictionaryService
GraphQLSitemapXmlService
Others as applicable.
Used graphQLClientFactory from @sitecore-jss/sitecore-jss-nextjs where possible.
Updated custom factory in create.ts to use GraphQLRequestClient.createClientFactory.
FEAAS Themes Plugin Adjustments
Removed usage of deprecated getFEAASLibraryStylesheetLinks from feaas-themes.ts.
Codebase Alignment with JSS v22+
Refactored code to match new APIs and types introduced in JSS v22+.
Removed deprecated imports and configuration options.
Ensured all GraphQL and dictionary services follow the new factory pattern.
Documentation Reference
Followed Sitecore’s official upgrade guide:
[](Upgrade JSS 21.7 Next.js apps to version 22.0.0)