Skip to content

Commit

Permalink
MA-15712: fix remix-run version issue
Browse files Browse the repository at this point in the history
  • Loading branch information
nshvyryaev committed Nov 24, 2023
1 parent e078867 commit 081d43b
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 6 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
v1.3.1
-
- Фикс проблемы UNSAFE_getPathContributingMatches в версии 1.13.0 @remix-run/router (https://github.com/VKCOM/vk-mini-apps-router/issues/299)

v1.3.0
-
- Починили скролл при переходе назад по истории

v1.2.0
-
- Добавили возможность заблокировать переход со страницы `RouteNavigator.block(onLeave: BlockerFunction))`
- Добавили возможность пробросить `state` в `NavigationOptions` в методы push и replace
- Расширили возможности настройки поведения в случае, когда маршрут не найден:
1. Можно выбирать, что делать если путь не найден: показывать 404 или переходить на определенную страницу
2. Можно настроить, какую страницу показывать (`notFoundRedirectPath`)

v1.1.1
-
- Починили проблему с `useFirstPageCheck`, который работал нестабильно
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"prepublishOnly": "yarn build"
},
"dependencies": {
"@remix-run/router": "^1.7.1"
"@remix-run/router": "^1.13.0"
},
"peerDependencies": {
"@vkontakte/vk-bridge": "^2.7.2",
Expand Down
34 changes: 33 additions & 1 deletion src/hooks/useResolvedPath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,44 @@ import {
RelativeRoutingType,
resolveTo,
To,
UNSAFE_getPathContributingMatches as getPathContributingMatches,
AgnosticRouteMatch
} from '@remix-run/router';
import { RouterContext } from '../contexts';
import { useContext, useMemo } from 'react';
import { useLocation } from './hooks';

/**
* @private
*
* When processing relative navigation we want to ignore ancestor routes that
* do not contribute to the path, such that index/pathless layout routes don't
* interfere.
*
* For example, when moving a route element into an index route and/or a
* pathless layout route, relative link behavior contained within should stay
* the same. Both of the following examples should link back to the root:
*
* <Route path="/">
* <Route path="accounts" element={<Link to=".."}>
* </Route>
*
* <Route path="/">
* <Route path="accounts">
* <Route element={<AccountsLayout />}> // <-- Does not contribute
* <Route index element={<Link to=".."} /> // <-- Does not contribute
* </Route
* </Route>
* </Route>
*/
function getPathContributingMatches<
T extends AgnosticRouteMatch = AgnosticRouteMatch
>(matches: T[]) {
return matches.filter(
(match, index) =>
index === 0 || (match.route.path && match.route.path.length > 0)
);
}

/**
* Resolves the pathname of the given `to` value against the current location.
*
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -301,10 +301,10 @@
"@nodelib/fs.scandir" "2.1.5"
fastq "^1.6.0"

"@remix-run/router@^1.7.1":
version "1.7.1"
resolved "https://registry.yarnpkg.com/@remix-run/router/-/router-1.7.1.tgz#fea7ac35ae4014637c130011f59428f618730498"
integrity sha512-bgVQM4ZJ2u2CM8k1ey70o1ePFXsEzYVZoWghh6WjM8p59jQ7HxzbHW4SbnWFG7V9ig9chLawQxDTZ3xzOF8MkQ==
"@remix-run/router@^1.13.0":
version "1.13.0"
resolved "https://registry.yarnpkg.com/@remix-run/router/-/router-1.13.0.tgz#7e29c4ee85176d9c08cb0f4456bff74d092c5065"
integrity sha512-5dMOnVnefRsl4uRnAdoWjtVTdh8e6aZqgM4puy9nmEADH72ck+uXwzpJLEKE9Q6F8ZljNewLgmTfkxUrBdv4WA==

"@types/json-schema@^7.0.7":
version "7.0.12"
Expand Down

0 comments on commit 081d43b

Please sign in to comment.