Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/nc-gui/components/feed/Social.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const socialIcons = [
name: '@nocodb',
icon: iconMap.iconTwitter,
link: 'https://twitter.com/nocodb',
e: 'c:feed::twitter-open',
e: 'c:feed:twitter-open',
},
{
name: 'NocoDB',
Expand Down
18 changes: 14 additions & 4 deletions packages/nc-gui/components/feed/View.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,19 @@ const tabs: Array<{
},
]

const updateTab = (key: string) => {
$e(`c:nocodb:feed, tab:${key}`)
}
const router = useRouter()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Add missing import for useRouter

The useRouter function is used on line 49 but is not imported. This will result in a ReferenceError at runtime.

Please add the following import statement at the top of your script:

+import { useRouter } from 'vue-router'
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const router = useRouter()
import { useRouter } from 'vue-router'
const router = useRouter()


watch(activeTab, (val) => {
$e('c:nocodb:feed', { tab: val })
router.push({ query: { tab: val } })
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Preserve existing query parameters when updating the route

The call to router.push({ query: { tab: val } }) replaces all existing query parameters with the new tab parameter. This may unintentionally remove other query parameters that are important for navigation or state.

Consider merging the new tab parameter with the existing query parameters to prevent loss of data:

-router.push({ query: { tab: val } })
+router.push({ 
+  query: { 
+    ...router.currentRoute.value.query, 
+    tab: val 
+  } 
+})
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
router.push({ query: { tab: val } })
router.push({
query: {
...router.currentRoute.value.query,
tab: val
}
})

})

onMounted(() => {
const tab = router.currentRoute.value.query.tab as string
if (tab && tabs.some((t) => t.key === tab)) {
activeTab.value = tab
}
})
</script>

<template>
Expand All @@ -58,7 +68,7 @@ const updateTab = (key: string) => {
<NcTabs v-model:activeKey="activeTab" centered>
<a-tab-pane v-for="tab in tabs" :key="tab.key" class="bg-gray-50 !h-full">
<template #tab>
<div class="flex gap-2 items-center" @click="updateTab(tab.key)">
<div class="flex gap-2 items-center">
<GeneralIcon
:class="{
'text-brand-500': activeTab === tab.key,
Expand Down