-
Notifications
You must be signed in to change notification settings - Fork 123
Refactor paypal provider #711
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
Refactor paypal provider #711
Conversation
|
| type: INSTANCE_DISPATCH_ACTION.RESET_STATE, | ||
| value: INSTANCE_LOADING_STATE.SDK_LOADED, | ||
| }); | ||
| // eslint-disable-next-line react-hooks/exhaustive-deps |
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.
I think we should turn what's missing here into refs rather than ignore the deps array.
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.
Would that mean keeping the sdkInstance in a ref AND in state? Would that open us up to issues if the instances aren't the same/managed?
| type: INSTANCE_DISPATCH_ACTION.SET_LOADING_STATUS, | ||
| value: INSTANCE_LOADING_STATE.SDK_LOADED, | ||
| }); | ||
| } catch (error) { |
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.
This setup looks good 👍
…l/paypal-js into feature/refactor-paypal-provider
| }, [memoizedScriptOptions]); // Only reset when script options change | ||
|
|
||
| // SDK loading effect - only runs on client (useEffect doesn't run during SSR) | ||
| useEffect(() => { |
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.
I think this useEffect might conflict with the useEffect on line 99. Also, having this dispatch separate from the createInstance call feels incorrect, as in, I think we should have this dispatch occur in the same effect as the create call.
|
Closing this PR in favor of the changes here which include some of the updates that have been demonstrated here. |
No description provided.