fix(web): use centralized vault detection for nav labels (#12729)
The Files app nav labels checked window.location.pathname directly, which missed hash-based vault routes and the post-login redirect target, so labels didn't always reflect vault state.
This commit is contained in:
1 parent
19c1cd2fa2
commit
f1dbac418b
2 files changed
+19
-5
No files matched your search
@@ -0,0 +1,14 @@
|
||||
Bugfix: Vault navigation labels not updating on switch
|
||||
|
||||
The Files app navigation labels for the personal space and spaces list
|
||||
sometimes kept showing the regular names instead of the vault-specific
|
||||
ones after switching into the vault, and vice versa. This happened
|
||||
because the vault detection only looked at the plain URL path and
|
||||
missed cases such as hash-based routes or the redirect right after
|
||||
logging in.
|
||||
|
||||
The vault detection has been centralized and now also recognizes
|
||||
hash-based vault routes and the post-login redirect target, so the
|
||||
navigation labels correctly reflect whether the user is in the vault.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/12729
|
||||
@@ -14,7 +14,8 @@ import {
|
||||
useCapabilityStore,
|
||||
useEmbedMode,
|
||||
useSpacesStore,
|
||||
useUserStore
|
||||
useUserStore,
|
||||
useVault
|
||||
} from '@ownclouders/web-pkg'
|
||||
import { extensions } from './extensions'
|
||||
import { buildRoutes } from '@ownclouders/web-pkg'
|
||||
@@ -40,8 +41,7 @@ const appInfo: ApplicationInformation = {
|
||||
}
|
||||
|
||||
export const navItems = (context: ComponentCustomProperties): AppNavigationItem[] => {
|
||||
const currentPath = window.location.pathname
|
||||
const isVault = currentPath.startsWith('/vault')
|
||||
const { isInVault } = useVault()
|
||||
const spacesStores = useSpacesStore()
|
||||
const userStore = useUserStore()
|
||||
const capabilityStore = useCapabilityStore()
|
||||
@@ -50,7 +50,7 @@ export const navItems = (context: ComponentCustomProperties): AppNavigationItem[
|
||||
return [
|
||||
{
|
||||
name() {
|
||||
return isVault ? $gettext('Safe-Personal') : $gettext('Personal')
|
||||
return isInVault ? $gettext('Safe-Personal') : $gettext('Personal')
|
||||
},
|
||||
icon: appInfo.icon,
|
||||
route: {
|
||||
@@ -103,7 +103,7 @@ export const navItems = (context: ComponentCustomProperties): AppNavigationItem[
|
||||
priority: 30
|
||||
},
|
||||
{
|
||||
name: isVault ? $gettext('Safe-Spaces') : $gettext('Spaces'),
|
||||
name: isInVault ? $gettext('Safe-Spaces') : $gettext('Spaces'),
|
||||
icon: 'layout-grid',
|
||||
route: {
|
||||
path: `/${appInfo.id}/spaces/projects`
|
||||
|
||||
Reference in new issue
Block a user