@prismicio/vue v4 Migration Guide
This is a guide for upgrading a project from @prismicio/vue v3 to v4.
@prismicio/vue v4 comes with our updated client, @prismicio/client v7. Breaking changes on this version are mainly inherited from @prismicio/client v7. The following instructions walk you through upgrading to the updated package.
- New utilities from
@prismicio/clientv7 are now available - Deprecated APIs from
@prismcio/clientv5 and v6 were removed - Deprecated APIs from
@prismicio/helpersv2 were removed - Deprecated APIs from
@prismicio/typesv0 were removed - Improved code-splitting and tree shaking
Update your package.json to use the latest version of @prismicio/vue.
{
"dependencies": {
"@prismicio/vue": "^4.0.0"
}
}Update your installed packages with npm.
npm installThe following changes are required when upgrading to @prismicio/vue v4.
APIs that were deprecated in @prismicio/client v5 and v6 were removed. If you didn’t migrate from them previously, you now need to.
this.$prismic.filter;
usePrismic().filter;
// Following examples only show the `usePrismic()` method but
// are also applicable for the `this.$prismic` method.
usePrismic().client.get();
// For `.get` and any other query methods
usePrismic().client.get({ filters: ... });
// For `.get` and any other query methods
usePrismic().client.get({ orderings: [{ field: "my.product.price", direction: "desc" }] };
usePrismic().client.graphQLFetch();Previously, @prismicio/helpers v2 helper functions had signatures in the following fashion:
asSomething(field, option1, option2, ..., optionN)To standardize and help our API grow better, we standardized those helper functions signatures to the following.
asSomething(field, options)While the old helper functions signatures will still work with @prismicio/client v7, they are now considered deprecated and will be removed in a future major. This affects three helper functions:
asLink()asHTML()asText()
While this is optional, we recommend that you migrate these helper functions to the new signature:
usePrismic().asLink(field, { linkResolver })
usePrismic().asHTML(field, { linkResolver })
usePrismic().asHTML(field, { serializer })
usePrismic().asHTML(field, { linkResolver, serializer })
usePrismic().asText(field, { separator })Can't find what you're looking for?
Need technical Support? Spot an error in the documentation? Get in touch with us on our Community Forum.