Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
@pinia/colada
Advanced tools
The missing data fetching library for Pinia
This is a more complete and production-ready (not yet!) version of the exercises from Mastering Pinia.
[!WARNING] Pinia Colada is still experimental and not ready for production. New versions might introduce breaking changes. Feedback regarding new and existing options and features is welcome!
Pinia Colada is an opinionated yet flexible data fetching layer on top of Pinia. It features
npm install pinia @pinia/colada
Install the plugins for the features you need:
import { createPinia } from 'pinia'
import { QueryPlugin } from '@pinia/colada'
app.use(createPinia())
// install after pinia
app.use(QueryPlugin, {
// optional options
})
<script lang="ts" setup>
import { getContactById, updateContact as _updateContact } from '~/api/contacts'
import { useRoute } from 'vue-router'
import { useQuery, useMutation } from '@pinia/colada'
const route = useRoute()
const { data: contact, isFetching } = useQuery({
// recognizes this query as ['contacts', id]
key: () => ['contacts', route.params.id],
query: () => getContactById(route.params.id),
})
const { mutate: updateContact } = useMutation({
// automatically invalidates the cache for ['contacts'] and ['contacts', id]
keys: ({ id }) => [['contacts'], ['contacts', id]],
mutation: _updateContact,
})
</script>
<template>
<section>
<ContactCard
:key="contact.id"
:contact="contact"
:is-updating="isFetching"
@update:contact="updateContact"
/>
</section>
</template>
0.4.0 (2024-02-06)
QueryPlugin
to configure useQuery()status
property, isPending
, isFetching
are now a
bit different.FAQs
The smart data fetching layer for Pinia
The npm package @pinia/colada receives a total of 985 weekly downloads. As such, @pinia/colada popularity was classified as not popular.
We found that @pinia/colada demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.