Skip to content

Commit

Permalink
client: Upgrade to react-router 7
Browse files Browse the repository at this point in the history
Not much relevant to us. Just the renaming of the package,
and the features behind the `future` flags being enabled by default.
https://github.com/remix-run/react-router/blob/08e4f2fd399543cab776f4be8a29181093a3702c/CHANGELOG.md#v700
https://reactrouter.com/upgrading/v6
  • Loading branch information
jtojnar committed Dec 29, 2024
1 parent 88deede commit 168e0e7
Show file tree
Hide file tree
Showing 18 changed files with 61 additions and 59 deletions.
2 changes: 1 addition & 1 deletion client/js/helpers/hooks.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useEffect, useState } from 'react';
import { useLocation } from 'react-router-dom';
import { useLocation } from 'react-router';
import { useMediaMatch } from 'rooks';

/**
Expand Down
2 changes: 1 addition & 1 deletion client/js/helpers/uri.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useLocation, useMatch } from 'react-router-dom';
import { useLocation, useMatch } from 'react-router';
import { FilterType } from '../Filter';

/**
Expand Down
12 changes: 2 additions & 10 deletions client/js/templates/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
Navigate,
useNavigate,
useLocation,
} from 'react-router-dom';
} from 'react-router';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { Collapse } from '@kunukn/react-collapse';
import classNames from 'classnames';
Expand Down Expand Up @@ -852,15 +852,7 @@ App.propTypes = {
*/
export function createApp({ basePath, appRef, configuration }) {
return (
<Router
basename={basePath}
future={{
// eslint-disable-next-line camelcase
v7_startTransition: true,
// eslint-disable-next-line camelcase
v7_relativeSplatPath: true,
}}
>
<Router basename={basePath}>
<App ref={appRef} configuration={configuration} />
</Router>
);
Expand Down
4 changes: 2 additions & 2 deletions client/js/templates/EntriesPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import React, {
forwardRef,
} from 'react';
import PropTypes from 'prop-types';
import { Link, useLocation, useParams } from 'react-router-dom';
import { Link, useLocation, useParams } from 'react-router';
import { useOnline } from 'rooks';
import { useStateWithDeps } from 'use-state-with-deps';
import nullable from 'prop-types-nullable';
Expand All @@ -28,7 +28,7 @@ import { LocalizationContext } from '../helpers/i18n';
import { useShouldReload } from '../helpers/hooks';
import { forceReload, makeEntriesLinkLocation } from '../helpers/uri';
import { HttpError } from '../errors';
import { useNavigate } from 'react-router-dom';
import { useNavigate } from 'react-router';

function reloadList({
fetchParams,
Expand Down
2 changes: 1 addition & 1 deletion client/js/templates/HashPassword.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import PropTypes from 'prop-types';
import React, { useCallback, useEffect, useState } from 'react';
import { useNavigate } from 'react-router-dom';
import { useNavigate } from 'react-router';
import { useInput } from 'rooks';
import { LoadingState } from '../requests/LoadingState';
import { HttpError } from '../errors';
Expand Down
2 changes: 1 addition & 1 deletion client/js/templates/Item.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import React, {
useState,
} from 'react';
import PropTypes from 'prop-types';
import { Link, useNavigate, useLocation } from 'react-router-dom';
import { Link, useNavigate, useLocation } from 'react-router';
import { usePreviousImmediate } from 'rooks';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import classNames from 'classnames';
Expand Down
2 changes: 1 addition & 1 deletion client/js/templates/LoginForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useCallback, useContext, useState } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { SpinnerBig } from './Spinner';
import { useLocation, useNavigate } from 'react-router-dom';
import { useLocation, useNavigate } from 'react-router';
import { HttpError, LoginError } from '../errors';
import { ConfigurationContext } from '../helpers/configuration';
import { LocalizationContext } from '../helpers/i18n';
Expand Down
2 changes: 1 addition & 1 deletion client/js/templates/NavFilters.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useCallback, useContext, useState, useMemo } from 'react';
import PropTypes from 'prop-types';
import { useEntriesParams } from '../helpers/uri';
import { Link, useLocation } from 'react-router-dom';
import { Link, useLocation } from 'react-router';
import classNames from 'classnames';
import { FilterType } from '../Filter';
import { makeEntriesLinkLocation, useForceReload } from '../helpers/uri';
Expand Down
2 changes: 1 addition & 1 deletion client/js/templates/NavSearch.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import React, {
useState,
} from 'react';
import PropTypes from 'prop-types';
import { useLocation, useNavigate } from 'react-router-dom';
import { useLocation, useNavigate } from 'react-router';
import classNames from 'classnames';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { makeEntriesLink } from '../helpers/uri';
Expand Down
2 changes: 1 addition & 1 deletion client/js/templates/NavSources.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useCallback, useMemo, useContext, useEffect } from 'react';
import PropTypes from 'prop-types';
import { Link, useLocation } from 'react-router-dom';
import { Link, useLocation } from 'react-router';
import { usePreviousImmediate } from 'rooks';
import classNames from 'classnames';
import { unescape } from 'html-escaper';
Expand Down
2 changes: 1 addition & 1 deletion client/js/templates/NavTags.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useContext, useMemo, useCallback, useState } from 'react';
import PropTypes from 'prop-types';
import nullable from 'prop-types-nullable';
import { Link, useLocation } from 'react-router-dom';
import { Link, useLocation } from 'react-router';
import classNames from 'classnames';
import { unescape } from 'html-escaper';
import {
Expand Down
2 changes: 1 addition & 1 deletion client/js/templates/NavToolBar.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useCallback, useContext, useState } from 'react';
import PropTypes from 'prop-types';
import { Link } from 'react-router-dom';
import { Link } from 'react-router';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import * as icons from '../icons';
import {
Expand Down
2 changes: 1 addition & 1 deletion client/js/templates/OpmlImport.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useCallback, useEffect, useRef, useState } from 'react';
import PropTypes from 'prop-types';
import { useOnline } from 'rooks';
import { Link, useNavigate } from 'react-router-dom';
import { Link, useNavigate } from 'react-router';
import { LoadingState } from '../requests/LoadingState';
import { HttpError, UnexpectedStateError } from '../errors';
import { importOpml } from '../requests/common';
Expand Down
2 changes: 1 addition & 1 deletion client/js/templates/SearchList.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useCallback, useMemo } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { useLocation, useNavigate } from 'react-router-dom';
import { useLocation, useNavigate } from 'react-router';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { makeEntriesLink } from '../helpers/uri';
import * as icons from '../icons';
Expand Down
2 changes: 1 addition & 1 deletion client/js/templates/Source.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useCallback, useContext, useEffect, useState } from 'react';
import { useRef } from 'react';
import { Menu, MenuButton, MenuItem } from '@szhsin/react-menu';
import { useNavigate, useLocation } from 'react-router-dom';
import { useNavigate, useLocation } from 'react-router';
import { fadeOut } from '@siteparts/show-hide-effects';
import { makeEntriesLinkLocation } from '../helpers/uri';
import PropTypes from 'prop-types';
Expand Down
2 changes: 1 addition & 1 deletion client/js/templates/SourcesPage.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useCallback, useContext, useEffect, useState } from 'react';
import { useMemo } from 'react';
import { Link, useNavigate, useLocation, useMatch } from 'react-router-dom';
import { Link, useNavigate, useLocation, useMatch } from 'react-router';
import Source from './Source';
import { SpinnerBig } from './Spinner';
import { LoadingState } from '../requests/LoadingState';
Expand Down
74 changes: 42 additions & 32 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"ramda": "^0.30.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.28.1",
"react-router": "^7.1.1",
"reset-css": "^5.0.1",
"rooks": "^7.1.1",
"tinykeys": "^3.0.0",
Expand Down

0 comments on commit 168e0e7

Please sign in to comment.