Skip to content

Commit

Permalink
profile onMounted bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Raajheer1 committed Mar 10, 2024
1 parent b63bd21 commit d0bdfee
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/views/Profile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ const route = useRoute();
const currentHashTab = computed(() => {
const hash = route.hash.slice(1); // Remove leading "#"
return tabs.value.findIndex((tab) => tab.toLowerCase() === hash) || 0;
const val = tabs.value.findIndex((tab) => tab.toLowerCase() === hash);
return val === -1 ? 0 : val;
});
watch(currentHashTab, (newTab) => {
Expand All @@ -64,6 +66,7 @@ watch(currentHashTab, (newTab) => {
// Initial check on component mount
onMounted(() => {
console.log(currentHashTab.value);

Check warning on line 69 in src/views/Profile.vue

View workflow job for this annotation

GitHub Actions / eslint (20.x)

Unexpected console statement
selectedTab.value = currentHashTab.value;
});
</script>
Expand Down

0 comments on commit d0bdfee

Please sign in to comment.