New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

swr

Package Overview
Dependencies
Maintainers
8
Versions
164
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

swr - npm Package Compare versions

Comparing version 2.1.2 to 2.1.3

6

_internal/dist/index.d.ts

@@ -273,5 +273,5 @@ import react, { FC, PropsWithChildren, MutableRefObject } from 'react';

keys(): IterableIterator<string>;
get(key: Key): State<Data> | undefined;
set(key: Key, value: State<Data>): void;
delete(key: Key): void;
get(key: string): State<Data> | undefined;
set(key: string, value: State<Data>): void;
delete(key: string): void;
}

@@ -278,0 +278,0 @@ interface StateDependencies {

@@ -30,3 +30,3 @@ import React, { useEffect, useLayoutEffect, createContext, useContext, useMemo, useRef, createElement, useState, useCallback } from 'react';

// Getter
()=>cache.get(key) || EMPTY_CACHE,
()=>!isUndefined(key) && cache.get(key) || EMPTY_CACHE,
// Setter

@@ -53,3 +53,3 @@ (info)=>{

// If we haven't done any client-side updates, we return the current value.
return cache.get(key) || EMPTY_CACHE;
return !isUndefined(key) && cache.get(key) || EMPTY_CACHE;
}

@@ -56,0 +56,0 @@ ];

@@ -36,3 +36,3 @@ Object.defineProperty(exports, '__esModule', { value: true });

// Getter
()=>cache.get(key) || EMPTY_CACHE,
()=>!isUndefined(key) && cache.get(key) || EMPTY_CACHE,
// Setter

@@ -59,3 +59,3 @@ (info)=>{

// If we haven't done any client-side updates, we return the current value.
return cache.get(key) || EMPTY_CACHE;
return !isUndefined(key) && cache.get(key) || EMPTY_CACHE;
}

@@ -62,0 +62,0 @@ ];

@@ -400,3 +400,3 @@ import { useRef, useMemo, useCallback, useDebugValue } from 'react';

// ...or invoke the function with the updated data to get the interval
const interval = isFunction(refreshInterval) ? refreshInterval(data) : refreshInterval;
const interval = isFunction(refreshInterval) ? refreshInterval(getCache().data) : refreshInterval;
// We only start the next interval if `refreshInterval` is not 0, and:

@@ -403,0 +403,0 @@ // - `force` is true, which is the start of polling

@@ -401,3 +401,3 @@ Object.defineProperty(exports, '__esModule', { value: true });

// ...or invoke the function with the updated data to get the interval
const interval = _internal.isFunction(refreshInterval) ? refreshInterval(data) : refreshInterval;
const interval = _internal.isFunction(refreshInterval) ? refreshInterval(getCache().data) : refreshInterval;
// We only start the next interval if `refreshInterval` is not 0, and:

@@ -404,0 +404,0 @@ // - `force` is true, which is the start of polling

{
"name": "swr",
"version": "2.1.2",
"version": "2.1.3",
"description": "React Hooks library for remote data fetching",

@@ -110,3 +110,3 @@ "keywords": [

"@playwright/test": "^1.30.0",
"swr": "2.1.2"
"swr": "2.1.3"
},

@@ -113,0 +113,0 @@ "peerDependencies": {

@@ -1,5 +0,5 @@

import { Key, SWRConfiguration, Middleware } from 'swr';
import { MutatorCallback, Key, SWRConfiguration, Middleware } from 'swr';
type SWRSubscriptionOptions<Data = any, Error = any> = {
next: (err?: Error | null, data?: Data) => void;
next: <T = Data>(err?: Error | null, data?: Data | MutatorCallback<T>) => void;
};

@@ -6,0 +6,0 @@ type SWRSubscription<SWRSubKey extends Key = Key, Data = any, Error = any> = SWRSubKey extends () => infer Arg | null | undefined | false ? (key: Arg, { next }: SWRSubscriptionOptions<Data, Error>) => void : SWRSubKey extends null | undefined | false ? never : SWRSubKey extends infer Arg ? (key: Arg, { next }: SWRSubscriptionOptions<Data, Error>) => void : never;

@@ -9,2 +9,3 @@ import useSWR from 'swr';

const [key] = serialize(_key);
const originKey = _key;
// Prefix the key to avoid conflicts with other SWR resources.

@@ -43,3 +44,3 @@ const subscriptionKey = key ? SUBSCRIPTION_PREFIX + key : undefined;

if (!refCount) {
const dispose = subscribe(key, {
const dispose = subscribe(originKey, {
next

@@ -46,0 +47,0 @@ });

@@ -15,2 +15,3 @@ Object.defineProperty(exports, '__esModule', { value: true });

const [key] = _internal.serialize(_key);
const originKey = _key;
// Prefix the key to avoid conflicts with other SWR resources.

@@ -49,3 +50,3 @@ const subscriptionKey = key ? SUBSCRIPTION_PREFIX + key : undefined;

if (!refCount) {
const dispose = subscribe(key, {
const dispose = subscribe(originKey, {
next

@@ -52,0 +53,0 @@ });

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