fix(cloud): show provider root items in browser
This commit is contained in:
@@ -127,9 +127,12 @@ async function load() {
|
|||||||
error.value = ''
|
error.value = ''
|
||||||
cloudStore.setBrowseState({ freshness: 'refreshing' })
|
cloudStore.setBrowseState({ freshness: 'refreshing' })
|
||||||
try {
|
try {
|
||||||
|
// "root" is a route-only sentinel. The browse API represents the
|
||||||
|
// connection root by omitting parent_ref (the empty string here).
|
||||||
|
const parentRef = folderId.value && folderId.value !== 'root' ? folderId.value : ''
|
||||||
const data = await api.getCloudFoldersByConnectionId(
|
const data = await api.getCloudFoldersByConnectionId(
|
||||||
connectionId.value,
|
connectionId.value,
|
||||||
folderId.value ?? 'root'
|
parentRef
|
||||||
)
|
)
|
||||||
items.value = data.items ?? []
|
items.value = data.items ?? []
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -71,10 +71,11 @@ afterEach(() => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
describe('CloudFolderView', () => {
|
describe('CloudFolderView', () => {
|
||||||
it('calls getCloudFoldersByConnectionId with connection UUID, never provider slug', async () => {
|
it('browses the connection root without forwarding the route-only root sentinel', async () => {
|
||||||
const w = mount(CloudFolderView, { global: { stubs: globalStubs } })
|
const w = mount(CloudFolderView, { global: { stubs: globalStubs } })
|
||||||
await flushPromises()
|
await flushPromises()
|
||||||
expect(api.getCloudFoldersByConnectionId).toHaveBeenCalledWith('uuid-conn-1', 'root')
|
expect(api.getCloudFoldersByConnectionId).toHaveBeenCalledWith('uuid-conn-1', '')
|
||||||
|
expect(api.getCloudFoldersByConnectionId).not.toHaveBeenCalledWith('uuid-conn-1', 'root')
|
||||||
// Never called with provider slug
|
// Never called with provider slug
|
||||||
expect(api.getCloudFoldersByConnectionId).not.toHaveBeenCalledWith('google_drive', expect.anything())
|
expect(api.getCloudFoldersByConnectionId).not.toHaveBeenCalledWith('google_drive', expect.anything())
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user