Skip to content

Commit a7b74fe

Browse files
committed
update to react 19 and other packages
1 parent 6d17324 commit a7b74fe

File tree

10 files changed

+264
-301
lines changed

10 files changed

+264
-301
lines changed

package-lock.json

Lines changed: 242 additions & 273 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@
4646
"@types/multer-s3": "^3.0.3",
4747
"@types/node": "^22.0.0",
4848
"@types/node-cron": "^3.0.11",
49-
"@types/react": "^18.2.52",
50-
"@types/react-dom": "^18.2.18",
49+
"@types/react": "19.1.12",
50+
"@types/react-dom": "19.1.9",
5151
"@types/react-router-dom": "^5.3.3",
5252
"@types/react-syntax-highlighter": "^15.5.13",
5353
"@typescript-eslint/eslint-plugin": "^8.33.1",
@@ -83,7 +83,7 @@
8383
"@mui/icons-material": "^6.4.12",
8484
"@mui/material": "^6.4.12",
8585
"@mui/utils": "^6.1.5",
86-
"@mui/x-date-pickers": "^7.0.0",
86+
"@mui/x-date-pickers": "^8.11.2",
8787
"@sentry/node": "^8.0.0",
8888
"@sentry/react": "^9.40.0",
8989
"@sentry/vite-plugin": "^4.0.0",
@@ -108,8 +108,8 @@
108108
"notistack": "^3.0.1",
109109
"pdf-parse-fork": "^1.2.0",
110110
"pg": "^8.11.3",
111-
"react": "^18.2.0",
112-
"react-dom": "^18.2.0",
111+
"react": "19.1.1",
112+
"react-dom": "19.1.1",
113113
"react-i18next": "^15.0.0",
114114
"react-markdown": "^9.0.1",
115115
"react-router-dom": "^6.22.0",
@@ -128,6 +128,6 @@
128128
"winston-gelf-transporter": "^1.0.2",
129129
"winston-loki": "^6.1.3",
130130
"xlsx": "^0.18.5",
131-
"zod": "3.25.61"
131+
"zod": "^4.1.8"
132132
}
133133
}

src/client/App.tsx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
import { Box, Button, CircularProgress, CssBaseline, Snackbar } from '@mui/material'
22
import { ThemeProvider } from '@mui/material/styles'
3-
import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFnsV3'
3+
import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns'
44
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'
55
import { fi } from 'date-fns/locale'
66
import { SnackbarProvider } from 'notistack'
7-
import React, { useEffect, useRef } from 'react'
7+
import React, { useEffect } from 'react'
88
import { Navigate, Outlet, useLocation, useParams } from 'react-router-dom'
99
import { initShibbolethPinger } from 'unfuck-spa-shibboleth-session'
10-
import { PUBLIC_URL } from '../config'
1110
import { Feedback } from './components/Feedback'
1211
import NavBar, { EmbeddedNavBar } from './components/NavBar'
13-
import { AppContext } from './contexts/AppContext'
1412
import { EmbeddedProvider, useIsEmbedded } from './contexts/EmbeddedContext'
1513
import useCurrentUser from './hooks/useCurrentUser'
1614
import { AnalyticsProvider } from './stores/analytics'
@@ -97,19 +95,17 @@ const App = () => {
9795
}
9896

9997
const Layout = () => {
100-
const appRef = useRef<HTMLDivElement>(null)
10198
const isEmbedded = useIsEmbedded()
10299

103100
return (
104-
<AppContext.Provider value={appRef}>
101+
<>
105102
<Box
106103
sx={{
107104
display: 'flex',
108105
flexDirection: 'column',
109106
minHeight: '100vh',
110107
height: 'auto',
111108
}}
112-
ref={appRef}
113109
>
114110
{isEmbedded ? <EmbeddedNavBar /> : <NavBar />}
115111
<Box sx={{ flex: 1, mt: '4rem' }}>
@@ -118,7 +114,7 @@ const Layout = () => {
118114
<Feedback />
119115
</Box>
120116
<AdminLoggedInAsBanner />
121-
</AppContext.Provider>
117+
</>
122118
)
123119
}
124120

src/client/components/Admin/Usage/UserAccordion.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import { KeyboardReturn } from '@mui/icons-material'
22
import { Accordion, AccordionActions, AccordionSummary, Box, Button, Typography } from '@mui/material'
33
import { grey } from '@mui/material/colors'
44
import { useTranslation } from 'react-i18next'
5-
import { User } from '../../../types'
5+
import type { User } from '../../../types'
6+
import type { JSX } from 'react'
67

78
const UserAccordion = ({
89
user,

src/client/components/ChatV2/AssistantInstructionsInput.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { TextField, Typography } from '@mui/material'
22
import VisibilityOffIcon from '@mui/icons-material/VisibilityOff'
33
import { useTranslation } from 'react-i18next'
4+
import type { JSX } from 'react'
45

56
const VisibilityOff = () => {
67
const { t } = useTranslation()

src/client/components/ChatV2/ChatBox.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export const ChatBox = ({
3131
isMobile,
3232
}: {
3333
disabled: boolean
34-
fileInputRef: React.RefObject<HTMLInputElement>
34+
fileInputRef: React.RefObject<HTMLInputElement | null>
3535
fileName: string
3636
tokenUsageWarning: string
3737
tokenUsageAlertOpen: boolean

src/client/components/common/RouterTabs.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { Tabs } from '@mui/material'
2-
import { get } from 'lodash'
32
import React from 'react'
43
import { matchPath, useLocation } from 'react-router-dom'
54

@@ -10,7 +9,7 @@ export const RouterTabs = ({ children }: { children: (React.ReactElement | false
109

1110
const activeIndex = React.Children.toArray(children)
1211
.filter((c) => React.isValidElement(c))
13-
.findIndex((c) => !!matchPath(pathname, stripSearch(get(c, 'props.to'))))
12+
.findIndex((c) => !!matchPath(pathname, stripSearch((c.props as { to: string }).to)))
1413

1514
return <Tabs value={activeIndex < 0 ? 0 : activeIndex}>{children}</Tabs>
1615
}

src/client/contexts/AppContext.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/server/services/rag/mockSearchTool.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ const mockSearch: typeof search = async (_index: RagIndex, _params: { query: str
2727

2828
export const getMockRagIndexSearchTool: typeof getRagIndexSearchTool = (ragIndex: RagIndex) =>
2929
tool(
30+
// @ts-expect-error Langchain types seem slightly broken, "cannot assign unknown to { query: string }"
3031
async ({ query }: { query: string }) => {
3132
console.log('Mock search tool invoked with query:', query)
3233
const { results: documents } = await mockSearch(ragIndex, SearchSchema.parse({ query }))

src/server/services/rag/searchTool.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,13 @@ import { RagIndex } from '../../db/models'
44
import { search } from './search'
55
import { SearchSchema } from '../../../shared/rag'
66

7+
const schema = z.object({
8+
query: z.string().describe('the query to search for'),
9+
})
10+
711
export const getRagIndexSearchTool = (ragIndex: RagIndex) =>
812
tool(
13+
// @ts-expect-error Langchain types seem slightly broken, "cannot assign unknown to { query: string }"
914
async ({ query }: { query: string }) => {
1015
console.log('Search tool invoked with query:', query)
1116
const { results: documents } = await search(ragIndex, SearchSchema.parse({ query }))
@@ -15,9 +20,7 @@ export const getRagIndexSearchTool = (ragIndex: RagIndex) =>
1520
{
1621
name: `document_search`, // Gotcha: function name must match '^[a-zA-Z0-9_\.-]+$' at least in AzureOpenAI. This name must satisfy the name in ChatToolDef type
1722
description: `Search documents in the materials (titled '${ragIndex.metadata.name}'). Prefer ${ragIndex.metadata.language}, which is the language used in the documents.`,
18-
schema: z.object({
19-
query: z.string().describe('the query to search for'),
20-
}),
23+
schema,
2124
responseFormat: 'content_and_artifact',
2225
},
2326
)

0 commit comments

Comments
 (0)