Skip to content

Commit efa5c0e

Browse files
committed
refactored contexts into own location to avoid vite issue
1 parent fa59422 commit efa5c0e

4 files changed

Lines changed: 9 additions & 5 deletions

File tree

src/client/components/AppContextProvider.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import { useAuth } from "@clerk/clerk-react";
2-
import { createContext, useCallback, useEffect, useState } from "react";
2+
import { useCallback, useEffect, useState } from "react";
33

44
import { About, BagAdd, BagDelete, BagEdit, DiscDetail, SignIn } from "@components";
55
import { INITIAL_FILTERS_ENABLED, INITIAL_FILTER_VALUES, View } from "@constants";
6+
import { AppContext } from "@contexts";
67
import { useApi, usePersistedState } from "@hooks";
7-
import type { TAppContext, TBag, TDisc, TModalProps } from "@types";
8-
9-
export const AppContext = createContext<TAppContext | null>(null);
8+
import type { TBag, TDisc, TModalProps } from "@types";
109

1110
export const AppContextProvider = ({ children }: { children: React.ReactNode }) => {
1211
const [view, setView] = usePersistedState(View.Search, "view");

src/client/contexts/app.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import type { TAppContext } from "@types";
2+
import { createContext } from "react";
3+
4+
export const AppContext = createContext<TAppContext | null>(null);

src/client/contexts/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from "./app";

src/client/hooks/useAppContext.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useContext } from "react";
22

3-
import { AppContext } from "@components";
3+
import { AppContext } from "@contexts";
44

55
export const useAppContext = () => {
66
const ctx = useContext(AppContext);

0 commit comments

Comments
 (0)