Skip to content

Commit

Permalink
feat(web): next 15 part 2 (#634)
Browse files Browse the repository at this point in the history
Some more needed changes so that nextjs production build compiles
correctly.
  • Loading branch information
geclos authored Nov 19, 2024
1 parent bacfb4e commit 0e25a0a
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
'use client'

import { use } from 'react'

import DestroyModal from '$/components/modals/DestroyModal'
import { useNavigate } from '$/hooks/useNavigate'
import { ROUTES } from '$/services/routes'
import useProjects from '$/stores/projects'

export default async function DestroyProject({
export default function DestroyProject({
params,
}: {
params: Promise<{ projectId: string }>
}) {
const { projectId } = await params
const { projectId } = use(params)
const navigate = useNavigate()
const { data, destroy } = useProjects()
const project = data.find((p) => p.id === Number(projectId))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client'

import { Usable, use, useMemo, useState } from 'react'
import { use, useMemo, useState } from 'react'
import { capitalize } from 'lodash-es'

import { MessageContent, TextContent } from '@latitude-data/compiler'
Expand Down Expand Up @@ -29,7 +29,7 @@ import useProviderLogs from '$/stores/providerLogs'
export default function ImportLogs({
params,
}: {
params: Usable<{ evaluationUuid: string }>
params: Promise<{ evaluationUuid: string }>
}) {
const { evaluationUuid } = use(params)
const navigate = useNavigate()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client'

import { Usable, use } from 'react'
import { use } from 'react'

import { EvaluationDto } from '@latitude-data/core/browser'
import DestroyModal from '$/components/modals/DestroyModal'
Expand All @@ -11,7 +11,7 @@ import useEvaluations from '$/stores/evaluations'
export default function DestroyEvaluation({
params,
}: {
params: Usable<{ evaluationUuid: string }>
params: Promise<{ evaluationUuid: string }>
}) {
const { evaluationUuid } = use(params)
const navigate = useNavigate()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client'

import { Usable, use } from 'react'
import { use } from 'react'

import DestroyModal from '$/components/modals/DestroyModal'
import { useNavigate } from '$/hooks/useNavigate'
Expand All @@ -10,7 +10,7 @@ import useProviderApiKeys from '$/stores/providerApiKeys'
export default function DestroyProviderApiKey({
params,
}: {
params: Usable<{ providerApiKeyId: string }>
params: Promise<{ providerApiKeyId: string }>
}) {
const { providerApiKeyId } = use(params)
const navigate = useNavigate()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client'

import { Usable, use } from 'react'
import { use } from 'react'

import DestroyModal from '$/components/modals/DestroyModal'
import { useNavigate } from '$/hooks/useNavigate'
Expand All @@ -10,7 +10,7 @@ import useUsers from '$/stores/users'
export default function DestroyUserMembership({
params,
}: {
params: Usable<{ userId: string }>
params: Promise<{ userId: string }>
}) {
const { userId } = use(params)
const navigate = useNavigate()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client'

import { Usable, use, useEffect } from 'react'
import { use, useEffect } from 'react'

import { FocusHeader } from '@latitude-data/web-ui'
import { confirmMagicLinkTokenAction } from '$/actions/magicLinkTokens/confirm'
Expand All @@ -10,7 +10,7 @@ import useLatitudeAction from '$/hooks/useLatitudeAction'
export default function ConfirmMagicLink({
params,
}: {
params: Usable<{ token: string }>
params: Promise<{ token: string }>
}) {
const { token } = use(params)
const { execute } = useLatitudeAction(confirmMagicLinkTokenAction, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ describe('GET logs', () => {

it('should return all logs', async () => {
const response = await GET(mockRequest, {
// @ts-expect-error - Not properly typed
params: {
projectId: project.id,
commitUuid: commit.uuid,
Expand All @@ -113,7 +112,6 @@ describe('GET logs', () => {
it('should should not fail with page=0', async () => {
mockRequest = new NextRequest('http://localhost:3000?page=0')
const response = await GET(mockRequest, {
// @ts-expect-error - Not properly typed
params: {
projectId: project.id,
commitUuid: commit.uuid,
Expand Down Expand Up @@ -147,7 +145,6 @@ describe('GET logs', () => {
})

const response = await GET(mockRequest, {
// @ts-expect-error - Not properly typed
params: {
projectId: project.id,
commitUuid: commit.uuid,
Expand All @@ -165,7 +162,6 @@ describe('GET logs', () => {
it('should exclude logs with errors', async () => {
mockRequest = new NextRequest('http://localhost:3000?excludeErrors=true')
const response = await GET(mockRequest, {
// @ts-expect-error - Not properly typed
params: {
projectId: project.id,
commitUuid: commit.uuid,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ describe('GET /api/documents/[projectId]/[commitUuid]/[documentUuid]/evaluations
'http://localhost/api/documents/test-project/test-commit/test-document-uuid/evaluations',
)
const response = await GET(request, {
// @ts-expect-error
params: { documentUuid: documents[0]!.documentUuid },
workspace,
})
Expand Down Expand Up @@ -107,7 +106,6 @@ describe('GET /api/documents/[projectId]/[commitUuid]/[documentUuid]/evaluations
'http://localhost/api/documents/test-project/test-commit/test-document-uuid/evaluations',
)
const response = await GET(request, {
// @ts-expect-error
params: { documentUuid: documents[0]!.documentUuid },
workspace,
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ describe('GET handler for documents/[projectId]/for-import', () => {

it('should return documents for import when valid params are provided', async () => {
const response = await GET(mockRequest, {
// @ts-expect-error
params: mockParams,
workspace: mockWorkspace,
})
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/middlewares/errorHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { captureException } from '$/helpers/captureException'
import { NextRequest, NextResponse } from 'next/server'

export function errorHandler(handler: any) {
return async (req: NextRequest, res: NextResponse) => {
return async (req: NextRequest, res: any) => {
try {
return await handler(req, res)
} catch (error) {
Expand Down

0 comments on commit 0e25a0a

Please sign in to comment.