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

[React] [Next.js] Strongly typed SitecoreContext value #841

Merged
merged 1 commit into from
Nov 1, 2021

Conversation

illiakovalenko
Copy link
Contributor

@illiakovalenko illiakovalenko commented Oct 28, 2021

Description / Motivation

  • <SitecoreContext/> from sitecore-jss-react package should have exact type for context state
  • React sample should work as expected in connected/headless/integrated modes
  • Nextjs sample should work as expected using SSG/SSR modes
  • <Layout/> component shouldn't run render when it's unnecessary
  • (Additional issue which I noticed and fixed) Previously when you tried to switch language on the /styleguide page react re-rendered <Layout /> component twice. Now it's fixed and it was happening b\c we rendered array of routes, see https://github.com/Sitecore/jss/pull/841/files#diff-b6f3b4055f9147512d69014aa8a1d1df8d4c129713f504a4ca597c75e224bb49R37-R39
    updateSitecoreContext should trigger update for layout. Test it using:
    // withSitecoreContext({ updatable: true });
    // this.props.updateSitecoreContext(freshLayoutData);

BREAKING CHANGE

  • SitecoreContext accepts layoutData instead of context
  • SitecoreContext has strict state type instead of any

Testing Details

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update (non-breaking change; modified files are limited to the /docs directory)

@vercel
Copy link

vercel bot commented Oct 28, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/sitecore-jss/edge-e2e-styleguide/FCQ2uY1MbEaU368hateWZqqZ4MEo
✅ Preview: Failed

@illiakovalenko illiakovalenko requested a review from a team October 28, 2021 09:58
Copy link
Contributor

@CobyPear CobyPear left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@CobyPear CobyPear merged commit 7652d3c into dev Nov 1, 2021
@CobyPear CobyPear deleted the feature/461403 branch November 1, 2021 20:34
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.

None yet

2 participants