Skip to content

refactor(react-centra-checkout): make handler properties required - #794

Open
adamsoderstrom wants to merge 1 commit into
mainfrom
refactor/react-centra-checkout-required-context-values
Open

refactor(react-centra-checkout): make handler properties required#794
adamsoderstrom wants to merge 1 commit into
mainfrom
refactor/react-centra-checkout-required-context-values

Conversation

@adamsoderstrom

Copy link
Copy Markdown
Member

Since we already perform assertions on the existence of the context
values from the useCentraHandlers and useCentraSelection,
optional properties doesn't resemble the runtime values.

Since we already perform assertions on the existence of the context
values from the `useCentraHandlers` and `useCentraSelection`,
optional properties doesn't resemble the runtime values.
@adamsoderstrom
adamsoderstrom requested a review from Copilot June 15, 2026 11:38
@changeset-bot

changeset-bot Bot commented Jun 15, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 62b2489

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@noaignite/react-centra-checkout Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercel Bot commented Jun 15, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment Jun 15, 2026 11:39am

Request Review

Copilot AI left a comment

Copy link
Copy Markdown

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 updates @noaignite/react-centra-checkout’s handler typing so ContextMethods handler properties are required (matching the provider’s runtime guarantees), and aligns internal typings/tests accordingly.

Changes:

  • Make all ContextMethods handler properties required (remove ? optionality).
  • Simplify useCallback typings to use ContextMethods['...'] directly (no NonNullable).
  • Update handler invocation in tests and add a changeset entry.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
packages/react-centra-checkout/src/Context.tsx Makes ContextMethods handlers required and updates internal callback typings to match.
packages/react-centra-checkout/src/Context.test.tsx Removes optional chaining when invoking handlers, reflecting required handler presence.
.changeset/required-checkout-handlers.md Adds release note for the typing change (version bump classification needs adjustment).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1 to +3
---
'@noaignite/react-centra-checkout': patch
---
@codecov

codecov Bot commented Jun 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

@@           Coverage Diff           @@
##             main     #794   +/-   ##
=======================================
  Coverage   70.42%   70.42%           
=======================================
  Files          66       66           
  Lines        1055     1055           
  Branches      265      265           
=======================================
  Hits          743      743           
  Misses        248      248           
  Partials       64       64           
Files with missing lines Coverage Δ
packages/react-centra-checkout/src/Context.tsx 64.44% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

2 participants