Skip to content

Commit

Permalink
fix back the context provider
Browse files Browse the repository at this point in the history
  • Loading branch information
shawnmclean committed Dec 26, 2024
1 parent 85c6af6 commit 85b3681
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
12 changes: 12 additions & 0 deletions apps/sovoli.com/src/app/[username]/context/UserProfileContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,15 @@ export const useUserProfile = () => {
}
return context;
};

export const UserProfileProvider = ({
children,
userProfile,
}: {
children: React.ReactNode;
userProfile: UserProfile;
}) => {
return (
<UserProfileContext value={userProfile}>{children}</UserProfileContext>
);
};
6 changes: 4 additions & 2 deletions apps/sovoli.com/src/app/[username]/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { notFound } from "next/navigation";

import { UserProfileContext } from "./context/UserProfileContext";
import { UserProfileProvider } from "./context/UserProfileContext";
import { getUserProfile, preload } from "./lib/getUserProfile";

interface Props {
Expand Down Expand Up @@ -32,5 +32,7 @@ export default async function Layout({ children, params }: Props) {

if (!user) return notFound();

return <UserProfileContext value={user}>{children}</UserProfileContext>;
return (
<UserProfileProvider userProfile={user}>{children}</UserProfileProvider>
);
}

0 comments on commit 85b3681

Please sign in to comment.