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

@nanostores/query

Package Overview
Dependencies
Maintainers
4
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nanostores/query - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

3

dist/main.d.ts
import { MapStore, ReadableAtom } from "nanostores";
export declare type KeyInput = string | Array<string | ReadableAtom<string | null | undefined>>;
declare type NoKey = null | undefined | void;
export declare type KeyInput = string | Array<string | ReadableAtom<string | NoKey>>;
declare type Key = string;

@@ -4,0 +5,0 @@ declare type KeyParts = string[];

@@ -22,12 +22,7 @@ import { map, onStart, onStop, atom } from "nanostores";

return;
const isKeyStillSame = () => store.key === key;
const set = (v) => {
if (isKeyStillSame()) {
if (store.key === key) {
store.set(v);
events.emit(SET_CACHE, key, v, true);
}
}, setKey = (k, v) => {
if (isKeyStillSame()) {
store.setKey(k, v);
}
};

@@ -53,6 +48,5 @@ const { dedupeTime = 4e3, fetcher } = {

_runningFetches.add(key);
setKey("loading", true);
try {
const promise = fetcher(...keyParts);
setKey("promise", promise);
set({ data: store.value.data, ...loading, promise });
const res = await promise;

@@ -153,8 +147,9 @@ cache.set(key, res);

};
const newImplFactory = (origin) => (listener) => {
const originListen = fetcherStore.listen;
fetcherStore.listen = (listener) => {
const unsub = originListen(listener);
listener(fetcherStore.value);
handleNewListener();
return origin(listener);
return unsub;
};
fetcherStore.listen = newImplFactory(fetcherStore.listen);
fetcherStore.subscribe = newImplFactory(fetcherStore.subscribe);
onStop(fetcherStore, () => {

@@ -161,0 +156,0 @@ fetcherStore.value = { ...notLoading };

{
"name": "@nanostores/query",
"version": "0.1.0",
"version": "0.1.1",
"description": "Tiny remote data fetching library for Nano Stores",

@@ -5,0 +5,0 @@ "scripts": {

@@ -8,3 +8,3 @@ # Nano Stores Query

- **Small**. 1.61 Kb (minified and gzipped).
- **Small**. 1.59 Kb (minified and gzipped).
- **Familiar DX**. If you've used [`swr`](https://swr.vercel.app/) or

@@ -11,0 +11,0 @@ [`react-query`](https://react-query-v3.tanstack.com/), you'll get the same treatment,

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