Skip to content

Commit

Permalink
Preserve last visited tab
Browse files Browse the repository at this point in the history
  • Loading branch information
gopikrishnan13 committed Aug 9, 2024
1 parent a5fef2f commit a55eff5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
11 changes: 9 additions & 2 deletions frontend/src/pages/Deal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ import {
Breadcrumbs,
call,
} from 'frappe-ui'
import { ref, computed, h, onMounted } from 'vue'
import { ref, computed, h, onMounted, watch } from 'vue'
import { useRouter } from 'vue-router'
const { $dialog, makeCall } = globalStore()
Expand Down Expand Up @@ -384,11 +384,19 @@ const deal = createResource({
},
})
const tabIndex = ref(0)
onMounted(() => {
let savedTabIndex = parseInt(localStorage.getItem('DealTabIndex'),10)
tabIndex.value = isNaN(savedTabIndex) || savedTabIndex < 0 ? 0 : savedTabIndex
if (deal.data) return
deal.fetch()
})
watch(tabIndex, (tabIndexValue)=>{
localStorage.setItem('DealTabIndex', tabIndexValue)
})
const reload = ref(false)
const showOrganizationModal = ref(false)
const showAssignmentModal = ref(false)
Expand Down Expand Up @@ -457,7 +465,6 @@ const breadcrumbs = computed(() => {
return items
})
const tabIndex = ref(0)
const tabs = computed(() => {
let tabOptions = [
{
Expand Down
10 changes: 9 additions & 1 deletion frontend/src/pages/Lead.vue
Original file line number Diff line number Diff line change
Expand Up @@ -355,11 +355,19 @@ const lead = createResource({
},
})
const tabIndex = ref(0)
onMounted(() => {
let savedTabIndex = parseInt(localStorage.getItem('LeadTabIndex'),10)
tabIndex.value = isNaN(savedTabIndex) || savedTabIndex < 0 ? 0 : savedTabIndex
if (lead.data) return
lead.fetch()
})
watch(tabIndex, (tabIndexValue)=>{
localStorage.setItem('LeadTabIndex', tabIndexValue)
})
const reload = ref(false)
const showAssignmentModal = ref(false)
const showSidePanelModal = ref(false)
Expand Down Expand Up @@ -422,7 +430,7 @@ const breadcrumbs = computed(() => {
return items
})
const tabIndex = ref(0)
const tabs = computed(() => {
let tabOptions = [
Expand Down

0 comments on commit a55eff5

Please sign in to comment.