[FA-11] Fix build errors, try to fix cache miss on node build
This commit is contained in:
@@ -6,7 +6,7 @@ const uri = import.meta.env.VITE_GRAPHQL_URI ?? 'https://localhost:5001/graphql'
|
||||
|
||||
const httpLink = new HttpLink({ uri })
|
||||
|
||||
const authLink = new SetContextLink(async ({ headers }, _) => {
|
||||
const authLink = new SetContextLink(async ({ headers }) => {
|
||||
if (!userManager) return { headers }
|
||||
try {
|
||||
const user = await userManager.getUser()
|
||||
|
||||
@@ -14,12 +14,11 @@ const AuthContext = createContext<AuthContextValue | undefined>(undefined)
|
||||
|
||||
export function AuthProvider({ children }: { children: ReactNode }) {
|
||||
const [user, setUser] = useState<User | null>(null)
|
||||
const [isLoading, setIsLoading] = useState(true)
|
||||
const [isLoading, setIsLoading] = useState(!!userManager)
|
||||
const callbackHandledRef = useRef(false)
|
||||
|
||||
useEffect(() => {
|
||||
if (!userManager) {
|
||||
setIsLoading(false)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -121,6 +120,7 @@ export function AuthProvider({ children }: { children: ReactNode }) {
|
||||
return <AuthContext.Provider value={value}>{children}</AuthContext.Provider>
|
||||
}
|
||||
|
||||
// eslint-disable-next-line react-refresh/only-export-components
|
||||
export function useAuth() {
|
||||
const context = useContext(AuthContext)
|
||||
if (!context) {
|
||||
|
||||
@@ -31,4 +31,5 @@ function Badge({ className, variant, ...props }: BadgeProps) {
|
||||
)
|
||||
}
|
||||
|
||||
// eslint-disable-next-line react-refresh/only-export-components
|
||||
export { Badge, badgeVariants }
|
||||
|
||||
@@ -51,4 +51,5 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
||||
)
|
||||
Button.displayName = 'Button'
|
||||
|
||||
// eslint-disable-next-line react-refresh/only-export-components
|
||||
export { Button, buttonVariants }
|
||||
|
||||
@@ -2,8 +2,7 @@ import * as React from 'react'
|
||||
|
||||
import { cn } from '../../lib/utils'
|
||||
|
||||
export interface InputProps
|
||||
extends React.InputHTMLAttributes<HTMLInputElement> {}
|
||||
export type InputProps = React.InputHTMLAttributes<HTMLInputElement>
|
||||
|
||||
const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
||||
({ className, type, ...props }, ref) => {
|
||||
|
||||
@@ -13,14 +13,13 @@ export function NovelsPage() {
|
||||
notifyOnNetworkStatusChange: true,
|
||||
})
|
||||
|
||||
const edges = data?.novels?.edges ?? []
|
||||
const pageInfo = data?.novels?.pageInfo
|
||||
const hasNextPage = pageInfo?.hasNextPage ?? false
|
||||
const endCursor = pageInfo?.endCursor ?? null
|
||||
|
||||
const novels = useMemo(
|
||||
() => edges.map((edge) => edge?.node).filter(Boolean),
|
||||
[edges]
|
||||
() => (data?.novels?.edges ?? []).map((edge) => edge?.node).filter(Boolean),
|
||||
[data?.novels?.edges]
|
||||
)
|
||||
|
||||
async function handleLoadMore() {
|
||||
|
||||
Reference in New Issue
Block a user