refactor(deps): update react-router-dom from v6 to 7.10.1 and adapt to breaking changes (#579)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Anton Tranelis <31516529+antontranelis@users.noreply.github.com>
Co-authored-by: mahula <lenzmath@posteo.de>
This commit is contained in:
dependabot[bot] 2025-12-18 13:01:42 +01:00 committed by GitHub
parent 0c9403f898
commit f099e7893d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
23 changed files with 89 additions and 71 deletions

View File

@ -21,8 +21,8 @@
"react": "^18.2.0", "react": "^18.2.0",
"react-dom": "^18.2.0", "react-dom": "^18.2.0",
"react-rnd": "^10.4.1", "react-rnd": "^10.4.1",
"react-router-dom": "^6.23.0", "react-router-dom": "^7.10.1",
"utopia-ui": "^3.0.111", "utopia-ui": "^3.0.112",
"vite-tsconfig-paths": "^5.1.4" "vite-tsconfig-paths": "^5.1.4"
}, },
"devDependencies": { "devDependencies": {

View File

@ -1,6 +1,6 @@
{ {
"name": "utopia-ui", "name": "utopia-ui",
"version": "3.0.111", "version": "3.0.112",
"description": "Reuseable React Components to build mapping apps for real life communities and networks", "description": "Reuseable React Components to build mapping apps for real life communities and networks",
"repository": "https://github.com/utopia-os/utopia-ui", "repository": "https://github.com/utopia-os/utopia-ui",
"homepage": "https://utopia-os.org/", "homepage": "https://utopia-os.org/",
@ -96,7 +96,7 @@
"peerDependencies": { "peerDependencies": {
"react": "^18.2.0", "react": "^18.2.0",
"react-dom": "^18.2.0", "react-dom": "^18.2.0",
"react-router-dom": "^6.23.0" "react-router-dom": "^7.10.1"
}, },
"dependencies": { "dependencies": {
"@heroicons/react": "^2.0.17", "@heroicons/react": "^2.0.17",

View File

@ -45,12 +45,12 @@ export const UserControl = () => {
const handleEdit = () => { const handleEdit = () => {
if (!myProfile?.layer) { if (!myProfile?.layer) {
navigate(userProfile.id ? `/edit-item/${userProfile.id}` : '#') void navigate(userProfile.id ? `/edit-item/${userProfile.id}` : '#')
return return
} }
if (myProfile.layer.itemType.small_form_edit && myProfile.position) { if (myProfile.layer.itemType.small_form_edit && myProfile.position) {
navigate('/') void navigate('/')
// Wait for navigation to complete before setting popup // Wait for navigation to complete before setting popup
setTimeout(() => { setTimeout(() => {
if (myProfile.position && myProfile.layer) { if (myProfile.position && myProfile.layer) {
@ -65,7 +65,7 @@ export const UserControl = () => {
} }
}, 100) }, 100)
} else { } else {
navigate(userProfile.id ? `/edit-item/${userProfile.id}` : '#') void navigate(userProfile.id ? `/edit-item/${userProfile.id}` : '#')
} }
} }
const avatar: string | undefined = const avatar: string | undefined =

View File

@ -51,9 +51,9 @@ export function LoginPage({ inviteApi, showRequestPassword }: Props) {
invitingProfileId = await redeemInvite(inviteCode) invitingProfileId = await redeemInvite(inviteCode)
} }
if (invitingProfileId) { if (invitingProfileId) {
navigate(`/item/${invitingProfileId}`) void navigate(`/item/${invitingProfileId}`)
} else { } else {
navigate('/') void navigate('/')
} }
}, [navigate, redeemInvite]) }, [navigate, redeemInvite])

View File

@ -20,7 +20,7 @@ export function RequestPasswordPage({ resetUrl }: { resetUrl: string }) {
await toast.promise(requestPasswordReset(email, resetUrl), { await toast.promise(requestPasswordReset(email, resetUrl), {
success: { success: {
render() { render() {
navigate('/') void navigate('/')
return 'Check your mailbox' return 'Check your mailbox'
}, },
// other options // other options

View File

@ -22,7 +22,7 @@ export function SetNewPasswordPage() {
await toast.promise(passwordReset(token, password), { await toast.promise(passwordReset(token, password), {
success: { success: {
render() { render() {
navigate('/') void navigate('/')
return 'New password set' return 'New password set'
}, },
}, },

View File

@ -25,7 +25,7 @@ export function SignupPage() {
await toast.promise(register({ email, password }, userName), { await toast.promise(register({ email, password }, userName), {
success: { success: {
render({ data }) { render({ data }) {
navigate('/') void navigate('/')
return `Hi ${data?.first_name ? data.first_name : 'Traveler'}` return `Hi ${data?.first_name ? data.first_name : 'Traveler'}`
}, },
// other options // other options

View File

@ -14,7 +14,7 @@ export const GratitudeControl = () => {
<div <div
className='tw:card-body tw:hover:bg-slate-300 tw:card tw:p-2 tw:h-10 tw:w-10 tw:transition-all tw:duration-300 tw:hover:cursor-pointer' className='tw:card-body tw:hover:bg-slate-300 tw:card tw:p-2 tw:h-10 tw:w-10 tw:transition-all tw:duration-300 tw:hover:cursor-pointer'
onClick={() => { onClick={() => {
navigate('/select-user') void navigate('/select-user')
}} }}
> >
<HeartIcon className='tw:stroke-[2.5]' /> <HeartIcon className='tw:stroke-[2.5]' />

View File

@ -195,7 +195,7 @@ export const LocateControl = (): React.JSX.Element => {
} }
// Navigate to the profile to show the popup // Navigate to the profile to show the popup
navigate(`/${result.id}`) void navigate(`/${result.id}`)
// Clean up and reset state // Clean up and reset state
setFoundLocation(null) setFoundLocation(null)

View File

@ -73,11 +73,13 @@ export function EditMenu({
className='tw:text-base-content! tw:tooltip tw:tooltip-top tw:cursor-pointer' className='tw:text-base-content! tw:tooltip tw:tooltip-top tw:cursor-pointer'
data-tip='Edit' data-tip='Edit'
onClick={(e) => { onClick={(e) => {
item.layer?.customEditLink if (item.layer?.customEditLink) {
? navigate( void navigate(
`${item.layer.customEditLink}${item.layer.customEditParameter ? `/${item.id}${params.toString() ? '?' + params.toString() : ''}` : ''}`, `${item.layer.customEditLink}${item.layer.customEditParameter ? `/${item.id}${params.toString() ? '?' + params.toString() : ''}` : ''}`,
) )
: editCallback(e) } else {
editCallback(e)
}
}} }}
> >
<PencilIcon className='tw:h-5 tw:w-5' /> <PencilIcon className='tw:h-5 tw:w-5' />

View File

@ -81,7 +81,7 @@ export const ItemViewPopup = forwardRef((props: ItemViewPopupProps, ref: any) =>
setLoading(false) setLoading(false)
map.closePopup() map.closePopup()
removeItemFromUrl() removeItemFromUrl()
navigate('/') void navigate('/')
} }
return ( return (
@ -99,7 +99,7 @@ export const ItemViewPopup = forwardRef((props: ItemViewPopupProps, ref: any) =>
setPositionCallback={() => { setPositionCallback={() => {
map.closePopup() map.closePopup()
setSelectPosition(props.item) setSelectPosition(props.item)
navigate('/') void navigate('/')
}} }}
loading={loading} loading={loading}
/> />

View File

@ -117,7 +117,7 @@ function useFilterManager(initialTags: Tag[]): {
params.set('layers', visibleNames.join(',')) params.set('layers', visibleNames.join(','))
} }
navigate(`${location.pathname}?${params.toString()}`, { replace: true }) void navigate(`${location.pathname}?${params.toString()}`, { replace: true })
}, [visibleLayers, allLayers, navigate]) }, [visibleLayers, allLayers, navigate])
const [visibleGroupTypes, dispatchGroupTypes] = useReducer( const [visibleGroupTypes, dispatchGroupTypes] = useReducer(
@ -152,8 +152,8 @@ function useFilterManager(initialTags: Tag[]): {
params.set('tags', `${urlTags || ''}${urlTags ? ';' : ''}${tag.name}`) params.set('tags', `${urlTags || ''}${urlTags ? ';' : ''}${tag.name}`)
} }
if (windowDimensions.width < 786 && location.pathname.split('/').length > 2) if (windowDimensions.width < 786 && location.pathname.split('/').length > 2)
navigate('/' + (params ? `?${params}` : '')) void navigate('/' + (params ? `?${params}` : ''))
else navigate(location.pathname + (params ? `?${params}` : '')) else void navigate(location.pathname + (params ? `?${params}` : ''))
dispatchTags({ dispatchTags({
type: 'ADD_TAG', type: 'ADD_TAG',
@ -177,10 +177,10 @@ function useFilterManager(initialTags: Tag[]): {
}) })
if (newUrlTags !== '') { if (newUrlTags !== '') {
params.set('tags', newUrlTags) params.set('tags', newUrlTags)
navigate(location.pathname + (params ? `?${params}` : '')) void navigate(location.pathname + (params ? `?${params}` : ''))
} else { } else {
params.delete('tags') params.delete('tags')
navigate(location.pathname + (params ? `?${params}` : '')) void navigate(location.pathname + (params ? `?${params}` : ''))
} }
dispatchTags({ dispatchTags({

View File

@ -39,10 +39,10 @@ export function InvitePage({ inviteApi }: Props) {
if (invitingProfileId) { if (invitingProfileId) {
toast.success('Invite redeemed successfully!') toast.success('Invite redeemed successfully!')
navigate(`/item/${invitingProfileId}`) void navigate(`/item/${invitingProfileId}`)
} else { } else {
toast.error('Failed to redeem invite') toast.error('Failed to redeem invite')
navigate('/') void navigate('/')
} }
} }
@ -55,7 +55,7 @@ export function InvitePage({ inviteApi }: Props) {
localStorage.setItem('inviteCode', id) localStorage.setItem('inviteCode', id)
// Redirect to login page // Redirect to login page
navigate('/login') void navigate('/login')
} }
}, [ }, [
id, id,

View File

@ -187,12 +187,12 @@ export function ProfileView({ attestationApi }: { attestationApi?: ItemsApi<any>
}) })
}} }}
editCallback={() => { editCallback={() => {
navigate('/edit-item/' + item.id) void navigate('/edit-item/' + item.id)
}} }}
setPositionCallback={() => { setPositionCallback={() => {
map.closePopup() map.closePopup()
setSelectPosition(item) setSelectPosition(item)
navigate('/') void navigate('/')
}} }}
big big
truncateSubname={false} truncateSubname={false}

View File

@ -133,7 +133,7 @@ export const TabsForm = ({
key={i.id} key={i.id}
className='tw:cursor-pointer tw:card tw:bg-base-200 tw:border-[1px] tw:border-base-300 tw:card-body tw:shadow-xl tw:text-base-content tw:mx-4 tw:p-6 tw:mb-4' className='tw:cursor-pointer tw:card tw:bg-base-200 tw:border-[1px] tw:border-base-300 tw:card-body tw:shadow-xl tw:text-base-content tw:mx-4 tw:p-6 tw:mb-4'
onClick={() => { onClick={() => {
navigate('/item/' + i.id) void navigate('/item/' + i.id)
}} }}
> >
<LinkedItemsHeaderView <LinkedItemsHeaderView

View File

@ -286,7 +286,7 @@ export const TabsView = ({
key={i.id} key={i.id}
className='tw:cursor-pointer tw:card tw:bg-base-200 tw:border-[1px] tw:border-base-300 tw:card-body tw:shadow-xl tw:text-base-content tw:p-6 tw:mr-4 tw:mb-4' className='tw:cursor-pointer tw:card tw:bg-base-200 tw:border-[1px] tw:border-base-300 tw:card-body tw:shadow-xl tw:text-base-content tw:p-6 tw:mr-4 tw:mb-4'
onClick={() => { onClick={() => {
navigate('/item/' + i.id) void navigate('/item/' + i.id)
}} }}
> >
<LinkedItemsHeaderView <LinkedItemsHeaderView

View File

@ -48,7 +48,7 @@ export function UserSettings() {
}, },
}) })
.then(() => { .then(() => {
navigate('/') void navigate('/')
}) })
.catch((e) => { .catch((e) => {
throw e throw e

View File

@ -71,7 +71,7 @@ export const AttestationForm = ({ api }: { api?: ItemsApi<unknown> }) => {
}, },
) )
.then(() => { .then(() => {
navigate( void navigate(
'/item/' + '/item/' +
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands // eslint-disable-next-line @typescript-eslint/restrict-plus-operands
items.find( items.find(

View File

@ -35,7 +35,7 @@ export const ItemCard = ({
} }
if (i.layer.itemType.small_form_edit && i.position) { if (i.layer.itemType.small_form_edit && i.position) {
navigate('/') void navigate('/')
// Wait for navigation to complete before setting popup // Wait for navigation to complete before setting popup
setTimeout(() => { setTimeout(() => {
if (i.position && i.layer) { if (i.position && i.layer) {
@ -49,7 +49,7 @@ export const ItemCard = ({
} }
}, 100) }, 100)
} else { } else {
navigate('/edit-item/' + i.id) void navigate('/edit-item/' + i.id)
} }
} }
@ -60,8 +60,8 @@ export const ItemCard = ({
// We could have an onClick callback instead // We could have an onClick callback instead
const params = new URLSearchParams(window.location.search) const params = new URLSearchParams(window.location.search)
if (windowDimensions.width < 786 && i.position) if (windowDimensions.width < 786 && i.position)
navigate('/' + i.id + (params.size > 0 ? `?${params.toString()}` : '')) void navigate('/' + i.id + (params.size > 0 ? `?${params.toString()}` : ''))
else navigate(url + i.id + (params.size > 0 ? `?${params.toString()}` : '')) else void navigate(url + i.id + (params.size > 0 ? `?${params.toString()}` : ''))
}} }}
> >
<HeaderView <HeaderView
@ -74,7 +74,7 @@ export const ItemCard = ({
setPositionCallback={() => { setPositionCallback={() => {
map.closePopup() map.closePopup()
setSelectPosition(i) setSelectPosition(i)
navigate('/') void navigate('/')
}} }}
deleteCallback={() => { deleteCallback={() => {
deleteCallback(i) deleteCallback(i)

View File

@ -17,7 +17,7 @@ export function MapOverlayPage({
card?: boolean card?: boolean
}) { }) {
const closeScreen = () => { const closeScreen = () => {
navigate(`/${window.location.search ? window.location.search : ''}`) void navigate(`/${window.location.search ? window.location.search : ''}`)
} }
const navigate = useNavigate() const navigate = useNavigate()

View File

@ -70,7 +70,7 @@ export const MarketView = () => {
{groupAndCount(offers).map((o) => ( {groupAndCount(offers).map((o) => (
<TagView <TagView
onClick={() => { onClick={() => {
navigate(`/?tags=${o.object.name}`) void navigate(`/?tags=${o.object.name}`)
}} }}
key={o.object.id} key={o.object.id}
tag={o.object} tag={o.object}
@ -85,7 +85,7 @@ export const MarketView = () => {
{groupAndCount(needs).map((o) => ( {groupAndCount(needs).map((o) => (
<TagView <TagView
onClick={() => { onClick={() => {
navigate(`/?tags=${o.object.name}`) void navigate(`/?tags=${o.object.name}`)
}} }}
key={o.object.id} key={o.object.id}
tag={o.object} tag={o.object}

View File

@ -39,7 +39,7 @@ export const Tabs: React.FC<TabsProps> = ({ items, setUrlParams }: TabsProps) =>
setUrlParams(params) setUrlParams(params)
const newUrl = location.pathname + '?' + params.toString() const newUrl = location.pathname + '?' + params.toString()
navigate(newUrl, { replace: false }) void navigate(newUrl, { replace: false })
}, },
[location.pathname, location.search, navigate, setUrlParams], [location.pathname, location.search, navigate, setUrlParams],
) )

70
package-lock.json generated
View File

@ -22,8 +22,8 @@
"react": "^18.2.0", "react": "^18.2.0",
"react-dom": "^18.2.0", "react-dom": "^18.2.0",
"react-rnd": "^10.4.1", "react-rnd": "^10.4.1",
"react-router-dom": "^6.23.0", "react-router-dom": "^7.10.1",
"utopia-ui": "^3.0.111", "utopia-ui": "^3.0.112",
"vite-tsconfig-paths": "^5.1.4" "vite-tsconfig-paths": "^5.1.4"
}, },
"devDependencies": { "devDependencies": {
@ -139,7 +139,7 @@
}, },
"lib": { "lib": {
"name": "utopia-ui", "name": "utopia-ui",
"version": "3.0.111", "version": "3.0.112",
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
"dependencies": { "dependencies": {
"@heroicons/react": "^2.0.17", "@heroicons/react": "^2.0.17",
@ -233,7 +233,7 @@
"peerDependencies": { "peerDependencies": {
"react": "^18.2.0", "react": "^18.2.0",
"react-dom": "^18.2.0", "react-dom": "^18.2.0",
"react-router-dom": "^6.23.0" "react-router-dom": "^7.10.1"
} }
}, },
"lib/node_modules/@typescript-eslint/types": { "lib/node_modules/@typescript-eslint/types": {
@ -3102,15 +3102,6 @@
"integrity": "sha512-42aWfPrimMfDKDi4YegyS7x+/0tlzaqwPQCULLanv3DMIlu96KTJR0fM5isWX2UViOqlGnX6YFgqWepcX+XMNg==", "integrity": "sha512-42aWfPrimMfDKDi4YegyS7x+/0tlzaqwPQCULLanv3DMIlu96KTJR0fM5isWX2UViOqlGnX6YFgqWepcX+XMNg==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/@remix-run/router": {
"version": "1.23.0",
"resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.23.0.tgz",
"integrity": "sha512-O3rHJzAQKamUz1fvE0Qaw0xSFqsA/yafi2iqeE0pvdFtCO1viYx8QL6f3Ln/aCCTLxs68SLf0KPM9eSeM8yBnA==",
"license": "MIT",
"engines": {
"node": ">=14.0.0"
}
},
"node_modules/@rolldown/pluginutils": { "node_modules/@rolldown/pluginutils": {
"version": "1.0.0-beta.27", "version": "1.0.0-beta.27",
"resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.0-beta.27.tgz", "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.0-beta.27.tgz",
@ -6736,6 +6727,19 @@
"dev": true, "dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/cookie": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/cookie/-/cookie-1.1.1.tgz",
"integrity": "sha512-ei8Aos7ja0weRpFzJnEA9UHJ/7XQmqglbRwnf2ATjcB9Wq874VKH9kfjjirM6UhU2/E5fFYadylyhFldcqSidQ==",
"license": "MIT",
"engines": {
"node": ">=18"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/express"
}
},
"node_modules/core-js-compat": { "node_modules/core-js-compat": {
"version": "3.47.0", "version": "3.47.0",
"resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.47.0.tgz", "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.47.0.tgz",
@ -13609,36 +13613,42 @@
"license": "0BSD" "license": "0BSD"
}, },
"node_modules/react-router": { "node_modules/react-router": {
"version": "6.30.1", "version": "7.10.1",
"resolved": "https://registry.npmjs.org/react-router/-/react-router-6.30.1.tgz", "resolved": "https://registry.npmjs.org/react-router/-/react-router-7.10.1.tgz",
"integrity": "sha512-X1m21aEmxGXqENEPG3T6u0Th7g0aS4ZmoNynhbs+Cn+q+QGTLt+d5IQ2bHAXKzKcxGJjxACpVbnYQSCRcfxHlQ==", "integrity": "sha512-gHL89dRa3kwlUYtRQ+m8NmxGI6CgqN+k4XyGjwcFoQwwCWF6xXpOCUlDovkXClS0d0XJN/5q7kc5W3kiFEd0Yw==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@remix-run/router": "1.23.0" "cookie": "^1.0.1",
"set-cookie-parser": "^2.6.0"
}, },
"engines": { "engines": {
"node": ">=14.0.0" "node": ">=20.0.0"
}, },
"peerDependencies": { "peerDependencies": {
"react": ">=16.8" "react": ">=18",
"react-dom": ">=18"
},
"peerDependenciesMeta": {
"react-dom": {
"optional": true
}
} }
}, },
"node_modules/react-router-dom": { "node_modules/react-router-dom": {
"version": "6.30.1", "version": "7.10.1",
"resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.30.1.tgz", "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-7.10.1.tgz",
"integrity": "sha512-llKsgOkZdbPU1Eg3zK8lCn+sjD9wMRZZPuzmdWWX5SUs8OFkN5HnFVC0u5KMeMaC9aoancFI/KoLuKPqN+hxHw==", "integrity": "sha512-JNBANI6ChGVjA5bwsUIwJk7LHKmqB4JYnYfzFwyp2t12Izva11elds2jx7Yfoup2zssedntwU0oZ5DEmk5Sdaw==",
"license": "MIT", "license": "MIT",
"peer": true, "peer": true,
"dependencies": { "dependencies": {
"@remix-run/router": "1.23.0", "react-router": "7.10.1"
"react-router": "6.30.1"
}, },
"engines": { "engines": {
"node": ">=14.0.0" "node": ">=20.0.0"
}, },
"peerDependencies": { "peerDependencies": {
"react": ">=16.8", "react": ">=18",
"react-dom": ">=16.8" "react-dom": ">=18"
} }
}, },
"node_modules/react-toastify": { "node_modules/react-toastify": {
@ -14224,6 +14234,12 @@
"randombytes": "^2.1.0" "randombytes": "^2.1.0"
} }
}, },
"node_modules/set-cookie-parser": {
"version": "2.7.2",
"resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.7.2.tgz",
"integrity": "sha512-oeM1lpU/UvhTxw+g3cIfxXHyJRc/uidd3yK1P242gzHds0udQBYzs3y8j4gCCW+ZJ7ad0yctld8RYO+bdurlvw==",
"license": "MIT"
},
"node_modules/set-function-length": { "node_modules/set-function-length": {
"version": "1.2.2", "version": "1.2.2",
"resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz",