Skip to content

Commit

Permalink
fix: only show vectorize as remote storage if indexes present (#352)
Browse files Browse the repository at this point in the history
  • Loading branch information
RihanArfan authored Oct 28, 2024
1 parent f529918 commit 5decc03
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/features.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,10 +356,16 @@ export async function setupRemote(_nuxt: Nuxt, hub: HubConfig) {
}
})

const availableStorages = Object.keys(remoteManifest?.storage || {}).filter(k => hub[k as keyof typeof hub] && remoteManifest?.storage[k])
const availableStorages = Object.keys(remoteManifest?.storage || {}).filter((k) => {
if (k === 'vectorize') {
return Object.keys(hub.vectorize ?? {}).length && Object.keys(remoteManifest!.storage.vectorize!).length
}
return hub[k as keyof typeof hub] && remoteManifest?.storage[k]
})

if (availableStorages.length > 0) {
const storageDescriptions = availableStorages.map((storage) => {
if (storage === 'vectorize' && Object.keys(hub.vectorize || {}).length) {
if (storage === 'vectorize') {
const indexes = Object.keys(remoteManifest!.storage.vectorize!).join(', ')
return `\`${storage} (${indexes})\``
}
Expand Down

0 comments on commit 5decc03

Please sign in to comment.