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

3230 Sign-in broken following 13.3.0 #4221

Merged
merged 9 commits into from
Mar 12, 2024
Prev Previous commit
Next Next commit
PWA-3230::merged code for pwa-3214
git add packages/peregrine/lib/talons/SignIn/useSignIn.js
  • Loading branch information
glo82145 committed Jan 19, 2024
commit 28c737fe437719a15f1dabba7a8ac5e740d74d80
28 changes: 11 additions & 17 deletions packages/peregrine/lib/talons/SignIn/useSignIn.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@ import { useAwaitQuery } from '../../hooks/useAwaitQuery';
import { retrieveCartId } from '../../store/actions/cart';
import { useDropdown } from '@magento/peregrine/lib/hooks/useDropdown';


import DEFAULT_OPERATIONS from './signIn.gql';
import { useEventingContext } from '../../context/eventing';

export const useSignIn = props => {
const {
handleTriggerClick,
getCartDetailsQuery,
setDefaultUsername,
showCreateAccount,
Expand Down Expand Up @@ -66,13 +64,7 @@ export const useSignIn = props => {
const formApiRef = useRef(null);
const setFormApi = useCallback(api => (formApiRef.current = api), []);


const {
elementRef: currencyMenuRef,
expanded: currencyMenuIsOpen,
setExpanded: setCurrencyMenuIsOpen,
triggerRef: currencyMenuTriggerRef
} = useDropdown();
const { setExpanded: setCurrencyMenuIsOpen } = useDropdown();

const handleTrigger = useCallback(() => {
// Toggle Stores Menu.
Expand Down Expand Up @@ -113,13 +105,15 @@ export const useSignIn = props => {
});
const destinationCartId = await retrieveCartId();

// Merge the guest cart into the customer cart.
await mergeCarts({
variables: {
destinationCartId,
sourceCartId
}
});
if (destinationCartId != sourceCartId) {
// Merge the guest cart into the customer cart.
await mergeCarts({
variables: {
destinationCartId,
sourceCartId
}
});
}

// Ensure old stores are updated with any new data.

Expand Down Expand Up @@ -160,7 +154,7 @@ export const useSignIn = props => {
getCartDetails,
fetchCartDetails,
dispatch,
handleTriggerClick
handleTrigger
]
);

Expand Down