Skip to content

Commit 1466886

Browse files
committed
fix: always exclude routeParams
1 parent 3ba9093 commit 1466886

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

apps/renderer/src/lib/path-parser.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,13 @@ export type PathParams = {
104104

105105
export type ParseRegexpPathParamsOptions = {
106106
excludeNames?: string[]
107+
forceExcludeNames?: string[]
107108
}
108109
export const parseRegexpPathParams = (
109110
regexpPath: string,
110111
options?: ParseRegexpPathParamsOptions,
111112
) => {
112-
const { excludeNames = [] } = options || {}
113+
const { excludeNames = [], forceExcludeNames = [] } = options || {}
113114
const transformedPath = transformUriPath(regexpPath)
114115
const { tokens } = parse(transformedPath)
115116

@@ -151,7 +152,8 @@ export const parseRegexpPathParams = (
151152
(item) =>
152153
typeof item === "object" &&
153154
"name" in item &&
154-
(!excludeNames.includes(item.name) || !item.optional),
155+
(!excludeNames.includes(item.name) || !item.optional) &&
156+
!forceExcludeNames.includes(item.name),
155157
) as PathParams[]
156158
}
157159
export const parseFullPathParams = (path: string, regexpPath: string) => {

apps/renderer/src/modules/discover/DiscoverFeedForm.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,9 @@ export const DiscoverFeedForm = ({
122122
"lang",
123123
"sort",
124124
],
125+
forceExcludeNames: routeParams ? ["routeParams"] : [],
125126
}),
126-
[route.path],
127+
[route.path, routeParams],
127128
)
128129

129130
const formPlaceholder = useMemo<Record<string, string>>(() => {

0 commit comments

Comments
 (0)