Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
vicotor
frontend
Commits
71f45d05
Commit
71f45d05
authored
Oct 21, 2022
by
isstuev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
router push fix
parent
f1122f41
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
6 deletions
+10
-6
useQueryWithPages.ts
ui/txs/useQueryWithPages.ts
+10
-6
No files found.
ui/txs/useQueryWithPages.ts
View file @
71f45d05
...
...
@@ -43,9 +43,11 @@ export default function useQueryWithPages(queryName: string, filter: string) {
}
const
nextPageQuery
=
{
...
router
.
query
};
Object
.
entries
(
nextPageParams
).
forEach
(([
key
,
val
])
=>
nextPageQuery
[
key
]
=
val
.
toString
());
router
.
push
({
pathname
:
router
.
pathname
,
query
:
nextPageQuery
},
undefined
,
{
shallow
:
true
});
animateScroll
.
scrollToTop
({
duration
:
0
});
setPage
(
prev
=>
prev
+
1
);
router
.
push
({
pathname
:
router
.
pathname
,
query
:
nextPageQuery
},
undefined
,
{
shallow
:
true
})
.
then
(()
=>
{
animateScroll
.
scrollToTop
({
duration
:
0
});
setPage
(
prev
=>
prev
+
1
);
});
},
[
data
,
page
,
pageParams
,
router
]);
const
onPrevPageClick
=
useCallback
(()
=>
{
...
...
@@ -60,9 +62,11 @@ export default function useQueryWithPages(queryName: string, filter: string) {
Object
.
entries
(
nextPageParams
).
forEach
(([
key
,
val
])
=>
nextPageQuery
[
key
]
=
val
.
toString
());
}
router
.
query
=
nextPageQuery
;
router
.
push
({
pathname
:
router
.
pathname
,
query
:
nextPageQuery
},
undefined
,
{
shallow
:
true
});
animateScroll
.
scrollToTop
({
duration
:
0
});
setPage
(
prev
=>
prev
-
1
);
router
.
push
({
pathname
:
router
.
pathname
,
query
:
nextPageQuery
},
undefined
,
{
shallow
:
true
})
.
then
(()
=>
{
animateScroll
.
scrollToTop
({
duration
:
0
});
setPage
(
prev
=>
prev
-
1
);
});
},
[
router
,
page
,
pageParams
]);
const
resetPage
=
useCallback
(()
=>
{
...
...
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