Posterverse: a nested plugin's view inside a tab reaches the address
The shell owns the address for the views inside its tabs too: a nested composite's ?pane= / ?place= choice is recorded through the shared helper, only while this page owns its address, never as a tab switch, and the event stops at the shell.
This commit is contained in:
parent
c963a2a9fa
commit
8c05f6207a
1 changed files with 5 additions and 1 deletions
|
|
@ -74,7 +74,7 @@ import BackToTopButton from '@map/components/BackToTopButton.vue'
|
|||
import ShellLanguageMenu from '@map/components/ShellLanguageMenu.vue'
|
||||
import { saveLocale } from '@map/layouts/app-wrapper-material/languages.js'
|
||||
import { loadScriptOnce, whenTagDefined } from '@map/utils/embedScript.js'
|
||||
import { readViewKeys, writeViewKeys, onAddressChange, urlOwnerOf } from '@map/composables/useViewAddress.js'
|
||||
import { readViewKeys, writeViewKeys, onAddressChange, urlOwnerOf, ownAddress } from '@map/composables/useViewAddress.js'
|
||||
import { translate, LOCALES } from './src/strings.js'
|
||||
import { SECTIONS, TABS, resolveTabs } from './src/tabs.js'
|
||||
|
||||
|
|
@ -233,6 +233,9 @@ export default defineComponent({
|
|||
const want = this.requestedTab()
|
||||
const known = !want || this.tabs.some((t) => t.id === want)
|
||||
this.select(this.initialIndex(), { firstPaint: true, fromHistory: !known })
|
||||
// A nested plugin's choice inside a tab (?pane=, ?place=) reaches the address through the owner: recorded
|
||||
// only while this page owns its address, never a tab switch, and the event stops here.
|
||||
this._offOwn = ownAddress(this.$el, () => urlOwnerOf(this.cfg))
|
||||
// Back / Forward re-apply the tab from the address and never write (writing would lose Forward).
|
||||
this._offAddress = onAddressChange(({ tab }) => {
|
||||
const i = this.tabs.findIndex((t) => t.id === tab)
|
||||
|
|
@ -243,6 +246,7 @@ export default defineComponent({
|
|||
beforeUnmount() {
|
||||
if (this._langObs) { this._langObs.disconnect(); this._langObs = null }
|
||||
if (this._offAddress) { this._offAddress(); this._offAddress = null }
|
||||
if (this._offOwn) { this._offOwn(); this._offOwn = null }
|
||||
},
|
||||
methods: {
|
||||
tr(key, params) { return translate(this.uiLocale, key, params) },
|
||||
|
|
|
|||
Loading…
Reference in a new issue