Skip to content

Commit

Permalink
Don't throw route error in useScopeParam to fix opening "/abc/xyz" URL
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaw3d committed Jan 19, 2024
1 parent 0440c35 commit 723d21a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .changelog/1159.internal.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Simplify search scopes
Simplify search scopes and fix search on error pages
5 changes: 1 addition & 4 deletions src/app/hooks/useScopeParam.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useRouteLoaderData, useParams, useRouteError } from 'react-router-dom'
import { useRouteLoaderData, useParams } from 'react-router-dom'
import { Network } from '../../types/network'
import { AppError, AppErrors } from '../../types/errors'
import { SearchScope } from '../../types/searchScope'
Expand All @@ -14,9 +14,6 @@ export const useNetworkParam = (): Network | undefined => {
export const useScopeParam = (): SearchScope | undefined => {
const runtimeScope = useRouteLoaderData('runtimeScope') as SearchScope | undefined
const consensusScope = useRouteLoaderData('consensusScope') as SearchScope | undefined
const error = useRouteError()

if (error) throw error
return runtimeScope ?? consensusScope ?? undefined
}

Expand Down

0 comments on commit 723d21a

Please sign in to comment.