Skip to content

Commit

Permalink
Update to react@19. Closes #1997 (#2056)
Browse files Browse the repository at this point in the history
* update to react@19

* fix types

* Update renderer/src/pages/onboarding/Onboarding.tsx

Co-authored-by: Miroslav Bajtoš <[email protected]>

* recreate package-lock.json

---------

Co-authored-by: Miroslav Bajtoš <[email protected]>
  • Loading branch information
juliangruber and bajtos authored Feb 18, 2025
1 parent 8f29334 commit 21056df
Show file tree
Hide file tree
Showing 10 changed files with 3,328 additions and 2,011 deletions.
1 change: 0 additions & 1 deletion .github/workflows/dependabot-auto-approve-patch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ jobs:
- graphql
- dayjs
- autoprefixer
- react-helmet-async
- tailwindcss
- '@glif/'
- '@filecoin-station/core'
Expand Down
5,247 changes: 3,286 additions & 1,961 deletions package-lock.json

Large diffs are not rendered by default.

9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,9 @@
"ms": "^2.1.3",
"p-debounce": "^4.0.0",
"prettier": "^3.5.1",
"react": "^18.3.1",
"react": "19.0.0",
"react-chartjs-2": "^5.3.0",
"react-dom": "^18.3.1",
"react-helmet-async": "^2.0.5",
"react-dom": "19.0.0",
"react-router": "^7.1.5",
"split2": "^4.2.0",
"vite-plugin-svgr": "^4.3.0",
Expand All @@ -83,8 +82,8 @@
"@testing-library/react": "^16.2.0",
"@types/mocha": "^10.0.10",
"@types/node-fetch": "^2.6.12",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@types/react": "19.0.8",
"@types/react-dom": "19.0.3",
"@types/split2": "^4.2.3",
"@types/tmp": "^0.2.6",
"@typescript-eslint/eslint-plugin": "^5.62.0",
Expand Down
58 changes: 27 additions & 31 deletions renderer/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,47 +4,43 @@ import Onboarding from 'src/pages/onboarding/Onboarding'
import Dashboard from 'src/pages/dashboard/Dashboard'
import Sentry from 'src/components/Sentry'
import Plausible from 'src/components/Plausible'
import { HelmetProvider, Helmet } from 'react-helmet-async'
import { ROUTES } from 'src/lib/routes'
import Layout from 'src/components/Layout'
import Settings from 'src/pages/settings/Settings'
import Wallet from 'src/pages/wallet/Wallet'
import Modules from 'src/pages/modules/Modules'
import { DialogProvider } from './components/DialogProvider'
import { TooltipProvider } from '@radix-ui/react-tooltip'
import type { JSX } from 'react'

const App = ():JSX.Element => {
return (
<HelmetProvider>
<Helmet>
<title>Filecoin Station</title>
</Helmet>
<Router>
<TooltipProvider delayDuration={200}>
<DialogProvider>
<Routes>
<Route path={ROUTES.onboarding} element={<Onboarding />} />
<Route
path="*"
element={
<Layout>
<Sentry />
<Plausible />
<Routes>
<Route path={ROUTES.dashboard} element={<Dashboard />} />
<Route path={ROUTES.wallet} element={<Wallet />} />
<Route path={ROUTES.settings} element={<Settings />} />
<Route path={ROUTES.modules} element={<Modules />} />
</Routes>
</Layout>
}
>
</Route>
</Routes>
</DialogProvider>
</TooltipProvider>
</Router>
</HelmetProvider>
<Router>
<title>Filecoin Station</title>
<TooltipProvider delayDuration={200}>
<DialogProvider>
<Routes>
<Route path={ROUTES.onboarding} element={<Onboarding />} />
<Route
path="*"
element={
<Layout>
<Sentry />
<Plausible />
<Routes>
<Route path={ROUTES.dashboard} element={<Dashboard />} />
<Route path={ROUTES.wallet} element={<Wallet />} />
<Route path={ROUTES.settings} element={<Settings />} />
<Route path={ROUTES.modules} element={<Modules />} />
</Routes>
</Layout>
}
>
</Route>
</Routes>
</DialogProvider>
</TooltipProvider>
</Router>
)
}

Expand Down
14 changes: 5 additions & 9 deletions renderer/src/components/Plausible.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
import { Helmet } from 'react-helmet-async'

const Plausible = () => {
return (
<Helmet>
<script
defer
data-domain="app.station.filecoin.io"
src="https://plausible.io/js/plausible.local.js"
/>
</Helmet>
<script
defer
data-domain="app.station.filecoin.io"
src="https://plausible.io/js/plausible.local.js"
/>
)
}

Expand Down
2 changes: 1 addition & 1 deletion renderer/src/components/Transition.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const Transition = <C extends ElementType = typeof DEFAULT_ELEMENT>({
const Component = as || DEFAULT_ELEMENT

const [shouldRender, setShouldRender] = useState(on)
const timeout = useRef<ReturnType<typeof setTimeout>>()
const timeout = useRef<ReturnType<typeof setTimeout>>(undefined)

useEffect(() => {
if (!on) {
Expand Down
4 changes: 2 additions & 2 deletions renderer/src/hooks/StationWallet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ const useWallet = (): Wallet => {
const [walletTransactions, setWalletTransactions] = useState<FILTransaction[]>()
const [processingTransaction, setProcessingTransaction] = useState<FILTransactionProcessing>()

const timeoutRef = useRef<ReturnType<typeof setTimeout>>()
const processingTxRef = useRef<typeof processingTransaction>()
const timeoutRef = useRef<ReturnType<typeof setTimeout>>(undefined)
const processingTxRef = useRef<typeof processingTransaction>(undefined)
processingTxRef.current = processingTransaction

const setTransactions = useCallback((
Expand Down
1 change: 1 addition & 0 deletions renderer/src/pages/dashboard/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import ChartController from './ChartController'
import useStationRewards from 'src/hooks/StationRewards'
import RewardsInfo from './RewardsInfo'
import { bigIntFilToNumber } from 'src/lib/utils'
import type { JSX } from 'react'

const Dashboard = (): JSX.Element => {
const { historicalRewards, totalRewardsReceived, scheduledRewards } = useStationRewards()
Expand Down
1 change: 1 addition & 0 deletions renderer/src/pages/onboarding/Onboarding.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useState, useEffect, useCallback } from 'react'
import type { JSX } from 'react'
import { useNavigate } from 'react-router'
import { getOnboardingCompleted, setOnboardingCompleted } from 'src/lib/station-config'
import Onboarding from 'src/components/Onboarding'
Expand Down
2 changes: 1 addition & 1 deletion renderer/src/pages/wallet/TransactionHistory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const TransactionHistory = ({
const [completeTransactions, setCompleteTransactions] = useState<
Array<FILTransaction & { isNew?: boolean }>
>()
const transactionsRef = useRef<string[]>()
const transactionsRef = useRef<string[]>(undefined)

useEffect(() => {
const complete = walletTransactions?.filter(tx => tx.status !== 'processing')
Expand Down

0 comments on commit 21056df

Please sign in to comment.