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

react-redux-query

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-redux-query - npm Package Compare versions

Comparing version 0.3.2 to 0.3.3

9

actions.js

@@ -10,3 +10,3 @@ "use strict";

return {
type: 'SAVE',
type: 'REACT_REDUX_QUERY_SAVE',
payload: payload,

@@ -18,7 +18,10 @@ };

* Like save, but takes an updater function, which receives the response at key
* and must return a response.
* and must return a response, undefined, or null.
*
* - If updater returns undefined, don't modify response at key
* - If updater returns null, remove response at key from query branch
*/
function update(payload) {
return {
type: 'UPDATE',
type: 'REACT_REDUX_QUERY_UPDATE',
payload: payload,

@@ -25,0 +28,0 @@ };

@@ -13,3 +13,3 @@ import { QueryResponse } from './query'

return {
type: 'SAVE',
type: 'REACT_REDUX_QUERY_SAVE',
payload,

@@ -21,11 +21,14 @@ }

key: string
updater: (response: QueryResponse<QR>) => QR | undefined
updater: (response: QueryResponse<QR>) => QR | undefined | null
}
/**
* Like save, but takes an updater function, which receives the response at key
* and must return a response.
* and must return a response, undefined, or null.
*
* - If updater returns undefined, don't modify response at key
* - If updater returns null, remove response at key from query branch
*/
export function update<QR extends {} = any>(payload: Update<QR>): Action {
return {
type: 'UPDATE',
type: 'REACT_REDUX_QUERY_UPDATE',
payload,

@@ -35,2 +38,4 @@ }

export type Action = { type: 'SAVE'; payload: Save } | { type: 'UPDATE'; payload: Update<any> }
export type Action =
| { type: 'REACT_REDUX_QUERY_SAVE'; payload: Save }
| { type: 'REACT_REDUX_QUERY_UPDATE'; payload: Update<any> }
{
"name": "react-redux-query",
"version": "0.3.2",
"version": "0.3.3",
"author": "Kyle Bebak <kylebebak@gmail.com>",

@@ -5,0 +5,0 @@ "description": "React hooks and functions for SWR-style data fetching, caching and automatic updates, backed by Redux",

@@ -13,2 +13,13 @@ "use strict";

};
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -28,10 +39,16 @@ /**

switch (action.type) {
case 'SAVE': {
case 'REACT_REDUX_QUERY_SAVE': {
var _c = action.payload, response = _c.response, key = _c.key;
return __assign(__assign({}, state), (_a = {}, _a[key] = __assign(__assign({}, response), { receivedMs: receivedMs }), _a));
}
case 'UPDATE': {
case 'REACT_REDUX_QUERY_UPDATE': {
var _d = action.payload, updater = _d.updater, key = _d.key;
var res = updater(state[key]);
return __assign(__assign({}, state), (_b = {}, _b[key] = res !== null && res !== undefined ? __assign(__assign({}, res), { receivedMs: receivedMs }) : undefined, _b));
if (res === undefined)
return state;
if (res === null) {
var _e = state, _f = key, _ = _e[_f], rest = __rest(_e, [typeof _f === "symbol" ? _f : _f + ""]);
return rest;
}
return __assign(__assign({}, state), (_b = {}, _b[key] = __assign(__assign({}, res), { receivedMs: receivedMs }), _b));
}

@@ -38,0 +55,0 @@ default:

@@ -16,3 +16,3 @@ import { QueryState } from './query'

switch (action.type) {
case 'SAVE': {
case 'REACT_REDUX_QUERY_SAVE': {
const { response, key } = action.payload

@@ -26,10 +26,15 @@

case 'UPDATE': {
case 'REACT_REDUX_QUERY_UPDATE': {
const { updater, key } = action.payload
const res = updater(state[key])
if (res === undefined) return state
if (res === null) {
const { [key]: _, ...rest } = state
return rest
}
return {
...state,
[key]: res !== null && res !== undefined ? { ...res, receivedMs } : undefined,
[key]: { ...res, receivedMs },
}

@@ -36,0 +41,0 @@ }

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