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

feat/MSSDK-2126: Create Primer component without backend integration #457

Conversation

m4tewoosh
Copy link
Collaborator

Description

To introduce a Primer component similar to the existing Adyen component in the project. Import it using lazy loading. The component will import and initialize @primer-io/checkout-web but will not be integrated with the backend, resulting in an expected error.

@m4tewoosh m4tewoosh changed the base branch from main to feat/MSSDK-2064-psp-routing-primer-connector-phase-1 February 12, 2025 11:27
@@ -267,6 +267,15 @@ const UpdatePaymentDetailsPopup = () => {
const showPayPalWhenAdyenIsReady = () =>
shouldShowAdyen ? !!dropInInstance : true;

const adyenProps = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

you could inline this, no need to keep another variable in the memory

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

IMO it looks bad when inlined but sure, can inline it

Copy link
Collaborator

Choose a reason for hiding this comment

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

i just noticed - i don't think this should be an object. this object will be re-created on each render, causing rerenders down the line
if you pass the props as separate props, the rerender will happen only if any of them changes

@@ -0,0 +1,31 @@
import { lazy } from 'react';
Copy link
Collaborator

Choose a reason for hiding this comment

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

the src/hooks directory is meant to hold only context-agnostic, reusable hooks. this one is very context-specific, as it is used in only one component. please move it next to the component

The general rule is that a file should be placed in a location that is the "smallest" common parent location for all the other files that use it

@m4tewoosh m4tewoosh merged commit c1b28e6 into feat/MSSDK-2064-psp-routing-primer-connector-phase-1 Feb 14, 2025
3 checks passed
@m4tewoosh m4tewoosh deleted the feat/MSSDK-2126-create-primer-component-without-backend-integration branch February 14, 2025 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants