diff --git a/changelog/unreleased/bugfix-vault-nav-labels-not-updating-on-switch.md b/changelog/unreleased/bugfix-vault-nav-labels-not-updating-on-switch.md new file mode 100644 index 00000000000..ba00420ae0c --- /dev/null +++ b/changelog/unreleased/bugfix-vault-nav-labels-not-updating-on-switch.md @@ -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 diff --git a/web/packages/web-app-files/src/index.ts b/web/packages/web-app-files/src/index.ts index 1b0e11ea779..be285f26823 100644 --- a/web/packages/web-app-files/src/index.ts +++ b/web/packages/web-app-files/src/index.ts @@ -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`