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

chore(hydrogen): export CookieOptions #1153

Merged
merged 3 commits into from Aug 11, 2023

Conversation

remcolakens
Copy link
Contributor

@remcolakens remcolakens commented Jul 26, 2023

WHY are these changes introduced?

The type CookieOptions is not being exported from cartSetIdDefault.ts

WHAT is this pull request doing?

Added new export for CookieOptions from ./cartSetIdDefault.ts

HOW to test your changes?

In your remix application you can now use the correct type:

app/lib/constants.ts

import type { CookieOptions } from '@shopify/hydrogen';

export const cookieOptions: CookieOptions = {
    path: '/',
    maxage: 60 * 60 * 24 * 14, // 14 days
    samesite: 'Lax',
};

server.ts

import { cookieOptions } from '~/lib/constants';

const cart = createCartHandler({
    ...
    setCartId: cartSetIdDefault(cookieOptions),
});

Checklist

  • I've read the Contributing Guidelines
  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've added a changeset if this PR contains user-facing or noteworthy changes
  • I've added tests to cover my changes
  • I've added or updated the documentation

@wizardlyhel wizardlyhel merged commit d896c76 into Shopify:2023-07 Aug 11, 2023
7 of 8 checks passed
FrcPpe pushed a commit to FrcPpe/hydrogen that referenced this pull request Aug 13, 2023
@remcolakens remcolakens deleted the fix/cookie-export branch August 24, 2023 07:22
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

3 participants