Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ const capitalizedTimestamp = computed(() => {
})

watch(
() => unref(resource)?.mdate,
() => unref(resource)?.etag,
async () => {
if (unref(resource)) {
preview.value = await loadPreview({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
RouteLocation
} from '@opencloud-eu/web-test-helpers'
import { mock, mockDeep } from 'vitest-mock-extended'
import { reactive } from 'vue'
import { SpaceResource } from '@opencloud-eu/web-client'
import { AncestorMetaData, ImageDimension, ProcessorType } from '@opencloud-eu/web-pkg'
import { User } from '@opencloud-eu/web-client/graph/generated'
Expand Down Expand Up @@ -87,6 +88,25 @@ describe('Details SideBar Panel', () => {
expect.anything()
)
})
it('loads the preview again when the etag changes but the modification date stays the same', async () => {
const resource = reactive({ ...getResourceMock(), etag: 'initial-etag' }) as Resource
const { mocks, wrapper } = createWrapper({ resource })
await wrapper.vm.$nextTick()
await wrapper.vm.$nextTick()
expect(mocks.$previewService.loadPreview).toHaveBeenCalledTimes(1)

resource.etag = 'changed-etag'
await wrapper.vm.$nextTick()
await wrapper.vm.$nextTick()

expect(mocks.$previewService.loadPreview).toHaveBeenCalledTimes(2)
expect(mocks.$previewService.loadPreview).toHaveBeenLastCalledWith(
expect.objectContaining({ resource: expect.objectContaining({ etag: 'changed-etag' }) }),
expect.anything(),
expect.anything(),
expect.anything()
)
})
})
describe('status indicators', () => {
it('show if given on non-public page', () => {
Expand Down
Loading