Skip to content

fix: register vectorize utils even if not running remotely - #396

Merged
atinux merged 4 commits into
nuxt-hub:mainfrom
danielroe:fix/vectorize-types
Dec 17, 2024
Merged

atinux merged 4 commits into
nuxt-hub:mainfrom
danielroe:fix/vectorize-types

Conversation

@danielroe

Copy link
Copy Markdown
Collaborator

it feels more intuitive to do:

const vectorize = hubVectorize()
vectorize?.upsert(/* */)

rather than

const vectorize = typeof hubVectorize !== 'undefined' ? hubVectorize() : null
vectorize?.upsert(/* */)

added to which the latter is a type error, if you run nuxi prepare without the --remote flag.

@pkg-pr-new

pkg-pr-new Bot commented Dec 16, 2024 •

Copy link
Copy Markdown

Open in Stackblitz

npm i https://pkg.pr.new/nuxt-hub/core/@nuxthub/core@396

commit: 300754b

@atinux

atinux commented Dec 17, 2024

Copy link
Copy Markdown
Contributor

Thanks for the PR, I rather have hubVectorize() defined and that throws an error in development if no remote storage is used so no need to use the ?

@atinux
atinux merged commit efeabf9 into nuxt-hub:main Dec 17, 2024
@danielroe
danielroe deleted the fix/vectorize-types branch December 17, 2024 18:41
@danielroe

danielroe commented Dec 17, 2024 •

Copy link
Copy Markdown
Collaborator Author

for me, I want to be able to develop my site even if offline so I would suggest it doesn't throw an error if called without --remote - letting the user handle it is IMO a better DX

now I will have to handle calling it with a try/catch block which is less convenient

This branch was successfully deployed

1 active deployment
Preview — 300754be Deployed Dec 17, 2024 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants