Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 4 commits into from
Dec 17, 2024

Conversation

danielroe
Copy link
Contributor

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.

Copy link

pkg-pr-new bot commented Dec 16, 2024

Open in Stackblitz

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

commit: 300754b

@atinux
Copy link
Contributor

atinux commented Dec 17, 2024

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
7 checks passed
@danielroe danielroe deleted the fix/vectorize-types branch December 17, 2024 18:41
@danielroe
Copy link
Contributor Author

danielroe commented Dec 17, 2024

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

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