Skip to content

Commit f40ada1

Browse files
committed
Refactor ResourceListBar component to update router query when changing tabs
1 parent b048848 commit f40ada1

File tree

1 file changed

+8
-2
lines changed
  • lazyweb/components/desktop/ResourceListBar

1 file changed

+8
-2
lines changed

lazyweb/components/desktop/ResourceListBar/index.tsx

+8-2
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,10 @@ const ResourceListBar = (props: Props) => {
5757
}else{
5858
router.replace({
5959
pathname: '/',
60-
query: { tab: newTabs[id-1].slug },
60+
query: {
61+
...router.query,
62+
tab: newTabs[id-1].slug
63+
},
6164
}, undefined, { shallow: true })
6265
}
6366
setTabs(newTabs)
@@ -76,7 +79,10 @@ const ResourceListBar = (props: Props) => {
7679
if(localStorage.getItem('token') && !router.query.tab){
7780
router.replace({
7881
pathname: '/',
79-
query: { tab: 'all' },
82+
query: {
83+
...router.query,
84+
tab: 'all'
85+
},
8086
}, undefined, { shallow: true })
8187
}
8288

0 commit comments

Comments
 (0)