Skip to content

Commit

Permalink
fix: wrong types
Browse files Browse the repository at this point in the history
  • Loading branch information
dlhck committed Jan 14, 2025
1 parent 6da1039 commit 27f039a
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 13 deletions.
3 changes: 1 addition & 2 deletions app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ import { CartProvider } from 'components/cart/cart-context';
import { Navbar } from 'components/layout/navbar';
import { WelcomeToast } from 'components/welcome-toast';
import { GeistSans } from 'geist/font/sans';
import { getActiveChannel, getActiveOrder, getCart } from 'lib/vendure';
import { getActiveChannel, getActiveOrder } from 'lib/vendure';
import { ensureStartsWith } from 'lib/utils';
import { cookies } from 'next/headers';
import { ReactNode } from 'react';
import { Toaster } from 'sonner';
import './globals.css';
import { getActiveChannelQuery } from '../lib/vendure/queries/active-channel';
import { ChannelProvider } from '../components/cart/channel-context';

const { TWITTER_CREATOR, TWITTER_SITE, SITE_NAME } = process.env;
Expand Down
8 changes: 1 addition & 7 deletions components/cart/cart-context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,9 @@ export function CartProvider({
}) {
const initialCart = use(activeOrderPromise);

const updateCartItem = (merchandiseId: string, updateType: UpdateType) => {};

const addCartItem = (variant: ProductVariant, product: Product) => {};

const value = useMemo(
() => ({
cart: initialCart,
updateCartItem,
addCartItem
cart: initialCart
}),
[initialCart]
);
Expand Down
10 changes: 6 additions & 4 deletions components/cart/channel-context.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
'use client'
'use client';

import { createContext, PropsWithChildren, use, useContext, useOptimistic } from 'react';
import { createContext, PropsWithChildren, use, useContext } from 'react';
import { GetActiveChannelQuery } from '../../lib/vendure/types';

const ChannelContext = createContext<GetActiveChannelQuery | undefined>(undefined);
type ActiveCannel = GetActiveChannelQuery['activeChannel'];

const ChannelContext = createContext<ActiveCannel | undefined>(undefined);

export function ChannelProvider({
channelPromise,
children
}: PropsWithChildren<{
channelPromise: Promise<GetActiveChannelQuery | undefined>;
channelPromise: Promise<ActiveCannel | undefined>;
}>) {
const channel = use(channelPromise);

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"@graphql-codegen/cli": "^5.0.3",
"@graphql-codegen/typescript-generic-sdk": "^4.0.1",
"@graphql-codegen/typescript-operations": "^4.4.0",
"@graphql-typed-document-node/core": "^3.2.0",
"@tailwindcss/container-queries": "^0.1.1",
"@tailwindcss/typography": "^0.5.15",
"@types/node": "22.10.1",
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 27f039a

Please sign in to comment.