Skip to content

Commit

Permalink
fix: type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Trugamr committed Jan 13, 2024
1 parent bae2804 commit ea8dc81
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/components/stack-logs.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { UseStackLogsOptions, useStackLogs } from '~/lib/hooks/use-stack-logs'
import { StoredStack } from '~/lib/stack.server'
import type { Stack } from '~/lib/stack.server'
import { cn } from '~/lib/utils'

type StackLogs = {
stack: Pick<StoredStack, 'name'>
stack: Pick<Stack, 'name'>
className?: string
} & Pick<UseStackLogsOptions, 'initialLogs'>

Expand Down
4 changes: 2 additions & 2 deletions app/lib/hooks/use-stack-logs.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useReducer } from 'react'
import { StoredStack } from '~/lib/stack.server'
import type { Stack } from '~/lib/stack.server'
import { useEventSource } from '~/lib/hooks/use-event-source'

export type UseStackLogsOptions = {
Expand All @@ -10,7 +10,7 @@ const defaultUseStackLogsOptions: UseStackLogsOptions = {}
const defaultInitialLogs: string[] = []

export function useStackLogs(
stack: Pick<StoredStack, 'name'>,
stack: Pick<Stack, 'name'>,
{ initialLogs = defaultInitialLogs }: UseStackLogsOptions = defaultUseStackLogsOptions,
) {
const [logs, push] = useReducer((logs: string[], log: MessageEvent) => {
Expand Down
4 changes: 4 additions & 0 deletions app/routes/api.stacks.$name.logs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@ import { invariantResponse } from '@epic-web/invariant'
import { LoaderFunctionArgs } from '@remix-run/node'
import { eventStream } from 'remix-utils/sse/server'
import { getStackByName, getStackLogsProcess } from '~/lib/stack.server'
import { notFound } from '~/lib/utils'

export async function loader({ request, params }: LoaderFunctionArgs) {
invariantResponse(params.name, 'Stack name is required')

const stack = await getStackByName(params.name)
if (!stack) {
throw notFound(`Stack "${params.name}" not found`)
}

const process = getStackLogsProcess({ directory: stack.directory })

Expand Down

0 comments on commit ea8dc81

Please sign in to comment.