Skip to content

Conversation

@EsariUp
Copy link
Collaborator

@EsariUp EsariUp commented Sep 9, 2025

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)

@robearlam robearlam requested a review from Copilot September 9, 2025 04:33
Copy link
Contributor

Copilot AI left a 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.

Comment on lines 10 to 13
props.headLinks.push(
...getDesignLibraryStylesheetLinks(
props.layoutData,
process.env.SITECORE_EDGE_CONTEXT_ID || ''
Copy link

Copilot AI Sep 9, 2025

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.

Suggested change
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

Copilot uses AI. Check for mistakes.
Copy link
Collaborator Author

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

Comment on lines 35 to 39
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',
Copy link

Copilot AI Sep 9, 2025

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.

Copilot uses AI. Check for mistakes.
Copy link
Collaborator Author

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

Comment on lines 23 to 25
const resolvePointOfSale = (site: SiteInfo, language: string): string => {
return `${site.name}_${language}`;
};
Copy link

Copilot AI Sep 9, 2025

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.

Copilot uses AI. Check for mistakes.
Copy link
Collaborator Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants