Skip to content

Commit

Permalink
fix(web-app-preview): optionally access route query
Browse files Browse the repository at this point in the history
When filtering out files in preview app, access route query optionally in case it is undefined to prevent broken loading.
  • Loading branch information
LukasHirt committed Jan 17, 2025
1 parent 76fed42 commit f9849a6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: Optionally access preview app route query

We've fixed an issue where loading of preview app would fail due to missing route query. The route query is now accessed optionally meaning even when it undefined, the app still loads as expected.

https://github.com/owncloud/web/pull/12112
https://github.com/owncloud/web/issues/12108
4 changes: 2 additions & 2 deletions packages/web-app-preview/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,14 @@ export default defineComponent({
const files = props.activeFiles.filter((file) => {
if (
unref(props.currentFileContext.routeQuery)['q_share-visibility'] === 'hidden' &&
unref(props.currentFileContext.routeQuery)?.['q_share-visibility'] === 'hidden' &&
!(file as IncomingShareResource).hidden
) {
return false
}
if (
unref(props.currentFileContext.routeQuery)['q_share-visibility'] !== 'hidden' &&
unref(props.currentFileContext.routeQuery)?.['q_share-visibility'] !== 'hidden' &&
(file as IncomingShareResource).hidden
) {
return false
Expand Down
7 changes: 7 additions & 0 deletions packages/web-app-preview/tests/unit/app.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,13 @@ describe('Preview app', () => {
})
expect(wrapper.vm.filteredFiles.length).toStrictEqual(2)
})

it('should filter files even when routeQuery is undefined', () => {
const { wrapper } = createShallowMountWrapper({
currentFileContext: { routeQuery: undefined }
})
expect(wrapper.vm.filteredFiles.length).toStrictEqual(7)
})
})
})

Expand Down

0 comments on commit f9849a6

Please sign in to comment.