Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
5000c046
Commit
5000c046
authored
Mar 28, 2023
by
Alejandro Celaya
Committed by
Alejandro Celaya
Mar 29, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Treat route query params as optional
parent
89c6d398
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
4 deletions
+4
-4
AnnotationView.tsx
src/sidebar/components/AnnotationView.tsx
+1
-1
StreamSearchInput.tsx
src/sidebar/components/StreamSearchInput.tsx
+2
-2
route.js
src/sidebar/store/modules/route.js
+1
-1
No files found.
src/sidebar/components/AnnotationView.tsx
View file @
5000c046
...
...
@@ -22,7 +22,7 @@ function AnnotationView({
onLogin
,
}:
AnnotationViewProps
)
{
const
store
=
useSidebarStore
();
const
annotationId
=
store
.
routeParams
().
id
;
const
annotationId
=
store
.
routeParams
().
id
??
''
;
const
rootThread
=
useRootThread
();
const
userid
=
store
.
profile
().
userid
;
...
...
src/sidebar/components/StreamSearchInput.tsx
View file @
5000c046
...
...
@@ -14,7 +14,7 @@ export type StreamSearchInputProps = {
*/
function
StreamSearchInput
({
router
}:
StreamSearchInputProps
)
{
const
store
=
useSidebarStore
();
const
query
=
store
.
routeParams
().
q
;
const
{
q
}
=
store
.
routeParams
()
;
const
setQuery
=
(
query
:
string
)
=>
{
// Re-route the user to `/stream` if they are on `/a/:id` and then set
// the search query.
...
...
@@ -22,7 +22,7 @@ function StreamSearchInput({ router }: StreamSearchInputProps) {
};
return
(
<
SearchInput
query=
{
q
uery
}
onSearch=
{
setQuery
}
alwaysExpanded=
{
true
}
/>
<
SearchInput
query=
{
q
??
''
}
onSearch=
{
setQuery
}
alwaysExpanded=
{
true
}
/>
);
}
...
...
src/sidebar/store/modules/route.js
View file @
5000c046
...
...
@@ -19,7 +19,7 @@ const initialState = {
* - The "stream" route has a "q" (query) parameter.
* - The "sidebar" route has no parameters.
*
* @type {Record<string, string>}
* @type {Record<string, string
| undefined
>}
*/
params
:
{},
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment