Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@pinia/colada

Package Overview
Dependencies
Maintainers
0
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pinia/colada - npm Package Compare versions

Comparing version 0.11.0 to 0.11.1

14

dist/index.d.ts

@@ -428,3 +428,3 @@ import * as vue from 'vue';

/**
* Options used to create the query. They can be undefined during hydration but are needed for fetching. This is why
* Options used to create the query. They can be `null` during hydration but are needed for fetching. This is why
* `store.ensure()` sets this property. Note these options might be shared by multiple query entries when the key is

@@ -711,6 +711,6 @@ * dynamic.

/**
* Time in ms after which, once the data is no longer being used, it will be garbage collected to free resources.
* Time in ms after which, once the data is no longer being used, it will be garbage collected to free resources. Set to `false` to disable garbage collection.
* @default 300000 (5 minutes)
*/
gcTime?: number;
gcTime?: number | false;
/**

@@ -752,3 +752,3 @@ * The data which is initially set to the query while the query is loading for the first time.

staleTime: number;
gcTime: number;
gcTime: NonNullable<UseQueryOptions["gcTime"]>;
refetchOnWindowFocus: _RefetchOnControl;

@@ -801,10 +801,12 @@ refetchOnReconnect: _RefetchOnControl;

* Ensures the current data is fresh. If the data is stale, refetch, if not return as is.
* @param throwOnError - whether to throw an error if the refresh fails. Defaults to `false`
* @returns a promise that resolves when the refresh is done
*/
refresh: () => Promise<DataState<TResult, TError>>;
refresh: (throwOnError?: boolean) => Promise<DataState<TResult, TError>>;
/**
* Ignores fresh data and triggers a new fetch
* @param throwOnError - whether to throw an error if the fetch fails. Defaults to `false`
* @returns a promise that resolves when the fetch is done
*/
refetch: () => Promise<DataState<TResult, TError>>;
refetch: (throwOnError?: boolean) => Promise<DataState<TResult, TError>>;
}

@@ -811,0 +813,0 @@ /**

@@ -143,5 +143,7 @@ // src/use-mutation.ts

clearTimeout(entry.gcTimeout);
entry.gcTimeout = setTimeout(() => {
store.remove(entry);
}, entry.options.gcTime);
if (Number.isFinite(entry.options.gcTime)) {
entry.gcTimeout = setTimeout(() => {
store.remove(entry);
}, entry.options.gcTime);
}
}

@@ -171,3 +173,3 @@ function createQueryEntry(key, initialData, error = null, when = 0) {

get stale() {
return Date.now() > this.when + this.options.staleTime;
return Date.now() >= this.when + this.options.staleTime;
},

@@ -297,2 +299,3 @@ get active() {

const { signal } = abortController;
entry.pending?.abortController.abort();
const pendingCall = entry.pending = {

@@ -317,5 +320,4 @@ abortController,

});
throw error;
}
return entry.state.value;
throw error;
}).finally(() => {

@@ -336,2 +338,3 @@ entry.asyncStatus.value = "idle";

entry.pending?.abortController.abort(reason);
entry.asyncStatus.value = "idle";
entry.pending = null;

@@ -352,4 +355,10 @@ });

(key, data) => {
const entry = caches.get(key.map(stringifyFlatObject));
if (!entry) return;
const cacheKey = key.map(stringifyFlatObject);
let entry = caches.get(cacheKey);
if (!entry) {
caches.set(
cacheKey,
entry = scope.run(() => createQueryEntry(cacheKey))
);
}
setEntryState(entry, {

@@ -379,9 +388,2 @@ // if we don't cast, this is not technically correct

caches,
// TODO: figure out if worth or eslint is enough
// used to warn the user against wrong usage and redirect them to the docs
// to use `defineQuery()` instead
// warnChecksMap:
// process.env.NODE_ENV !== 'production'
// ? new WeakMap<object, boolean>()
// : undefined,
ensureDefinedQuery,

@@ -425,2 +427,4 @@ setQueryData,

[],
// NOTE: this could happen outside of an effect scope but since it's only for client side hydration, it should be
// fine to have global shallowRefs as they can still be cleared when needed
value && createQueryEntry([...parentKey, key], ...value)

@@ -715,4 +719,13 @@ );

const errorCatcher = () => entry.value.state.value;
const refresh = () => cacheEntries.refresh(entry.value).catch(errorCatcher);
const refetch = () => cacheEntries.fetch(entry.value).catch(errorCatcher);
const refresh = (throwOnError) => cacheEntries.refresh(entry.value).catch(
// true is not allowed but it works per spec as only callable onRejected are used
// https://tc39.es/ecma262/multipage/control-abstraction-objects.html#sec-performpromisethen
// In other words `Promise.rejects('ok').catch(true)` still rejects
// anything other than `true` falls back to the `errorCatcher`
throwOnError || errorCatcher
);
const refetch = (throwOnError) => cacheEntries.fetch(entry.value).catch(
// same as above
throwOnError || errorCatcher
);
const isPlaceholderData = computed3(

@@ -719,0 +732,0 @@ () => entry.value.placeholderData != null && entry.value.state.value.status === "pending"

{
"name": "@pinia/colada",
"type": "module",
"version": "0.11.0",
"version": "0.11.1",
"description": "The smart data fetching layer for Pinia",

@@ -86,3 +86,3 @@ "publishConfig": {

"@size-limit/preset-small-lib": "^11.1.6",
"@types/node": "^22.8.0",
"@types/node": "^22.8.1",
"@vitejs/plugin-vue": "^5.1.4",

@@ -93,6 +93,6 @@ "@vitest/coverage-v8": "^2.1.3",

"chalk": "^5.3.0",
"conventional-changelog-cli": "^4.0.0",
"conventional-changelog-cli": "^4.1.0",
"enquirer": "^2.4.1",
"eslint": "^9.13.0",
"execa": "^9.4.1",
"execa": "^9.5.0",
"globby": "^14.0.2",

@@ -108,3 +108,3 @@ "happy-dom": "^15.7.4",

"size-limit": "^11.1.6",
"tsup": "^8.3.4",
"tsup": "^8.3.5",
"typedoc": "^0.26.10",

@@ -116,3 +116,3 @@ "typedoc-plugin-markdown": "^4.2.9",

"vue": "^3.5.12",
"@pinia/colada": "0.11.0"
"@pinia/colada": "0.11.1"
},

@@ -119,0 +119,0 @@ "simple-git-hooks": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc