Skip to content

Commit

Permalink
18027-update cache name for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
ketaki-deodhar committed Oct 10, 2023
1 parent 9dc2da5 commit acf1c58
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/mixins/countries-provinces-mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ window['provinces'] = window['provinces'] || provinces
// global caching to improve performance when called multiple times
window['countryNameCache'] = {}
window['countryRegionsCache'] = {}
window['canadaRegionsCache'] = {}
window['canadaRegionsNoBCCache'] = {}

/**
* Mixin that allows VM access to useful country/province data and functions.
Expand Down Expand Up @@ -68,14 +68,14 @@ export default class CountriesProvincesMixin extends Vue {
*/
getCanadaRegionsExcludeBC (): Array<object> {
const countryCode = 'CA'
if (window['canadaRegionsCache'][countryCode]) return window['canadaRegionsCache'][countryCode]
if (window['canadaRegionsNoBCCache'][countryCode]) return window['canadaRegionsNoBCCache'][countryCode]
const result = window['provinces']
.filter(p => p.country === 'CA' && p.short !== 'BC')
.map(p => ({
name: p.english || p.name,
short: (p.short && p.short.length <= 2) ? p.short : '--'
}))
window['canadaRegionsCache'][countryCode] = result
window['canadaRegionsNoBCCache'][countryCode] = result
return result
}
}

0 comments on commit acf1c58

Please sign in to comment.