Comparing version 1.5.0 to 1.5.1
@@ -0,1 +1,5 @@ | ||
### 1.5.1 | ||
Added `--strictNullChecks` in TypeScript and fixed loads of types which had undefined / null options. Should let Pullstate play nicely with the other children now. | ||
## 1.5.0 | ||
@@ -2,0 +6,0 @@ |
@@ -97,3 +97,3 @@ import { IPullstateAllStores } from "./PullstateCore"; | ||
export declare type TAsyncActionUpdateCached<A, R, T extends string> = (args: A, updater: TUpdateFunction<R>, options?: IAsyncActionUpdateCachedOptions) => void; | ||
export declare type TAsyncActionDelayedRun<A> = (args?: A, options?: IAsyncActionRunOptions & { | ||
export declare type TAsyncActionDelayedRun<A> = (args: A, options: IAsyncActionRunOptions & { | ||
delay: number; | ||
@@ -100,0 +100,0 @@ clearOldRun?: boolean; |
@@ -512,7 +512,7 @@ import React,{useState,useRef,useEffect,useContext,useMemo}from'react';import produce$1 from'immer';const isEqual = require("fast-deep-equal"); | ||
const useWatch = (args = {}, { initiate = false, ssr = true, postActionEnabled = false, cacheBreakEnabled = false, } = {}) => { | ||
const responseRef = useRef(null); | ||
const prevKeyRef = useRef(null); | ||
const responseRef = useRef(); | ||
const prevKeyRef = useRef(); | ||
const key = _createKey(ordinal, args); | ||
let watchId = useRef(null); | ||
if (watchId.current === null) { | ||
let watchId = useRef(-1); | ||
if (watchId.current === -1) { | ||
watchId.current = watchIdOrd++; | ||
@@ -673,3 +673,4 @@ } | ||
}; | ||
const setCached = (args, result, { notify = true } = {}) => { | ||
const setCached = (args, result, options) => { | ||
const { notify = true } = options || {}; | ||
const key = _createKey(ordinal, args); | ||
@@ -684,3 +685,4 @@ const cache = onServer | ||
}; | ||
const updateCached = (args, updater, { notify = true, resetTimeCached = true } = {}) => { | ||
const updateCached = (args, updater, options) => { | ||
const { notify = true, resetTimeCached = true } = options || {}; | ||
const key = _createKey(ordinal, args); | ||
@@ -709,3 +711,4 @@ const cache = onServer | ||
}; | ||
const getCached = (args = {}, { checkCacheBreak = false } = {}) => { | ||
const getCached = (args = {}, options) => { | ||
const { checkCacheBreak = false } = options || {}; | ||
const key = _createKey(ordinal, args); | ||
@@ -804,3 +807,3 @@ let cacheBreakable = false; | ||
} | ||
instantiate({ hydrateSnapshot = null, ssr = false, } = {}) { | ||
instantiate({ hydrateSnapshot, ssr = false, } = {}) { | ||
if (!ssr) { | ||
@@ -807,0 +810,0 @@ const instantiated = new PullstateInstance(this.originStores, false); |
@@ -511,7 +511,7 @@ 'use strict';Object.defineProperty(exports,'__esModule',{value:true});function _interopDefault(e){return(e&&(typeof e==='object')&&'default'in e)?e['default']:e}var React=require('react'),React__default=_interopDefault(React),produce$1=_interopDefault(require('immer'));const isEqual = require("fast-deep-equal"); | ||
const useWatch = (args = {}, { initiate = false, ssr = true, postActionEnabled = false, cacheBreakEnabled = false, } = {}) => { | ||
const responseRef = React.useRef(null); | ||
const prevKeyRef = React.useRef(null); | ||
const responseRef = React.useRef(); | ||
const prevKeyRef = React.useRef(); | ||
const key = _createKey(ordinal, args); | ||
let watchId = React.useRef(null); | ||
if (watchId.current === null) { | ||
let watchId = React.useRef(-1); | ||
if (watchId.current === -1) { | ||
watchId.current = watchIdOrd++; | ||
@@ -672,3 +672,4 @@ } | ||
}; | ||
const setCached = (args, result, { notify = true } = {}) => { | ||
const setCached = (args, result, options) => { | ||
const { notify = true } = options || {}; | ||
const key = _createKey(ordinal, args); | ||
@@ -683,3 +684,4 @@ const cache = onServer | ||
}; | ||
const updateCached = (args, updater, { notify = true, resetTimeCached = true } = {}) => { | ||
const updateCached = (args, updater, options) => { | ||
const { notify = true, resetTimeCached = true } = options || {}; | ||
const key = _createKey(ordinal, args); | ||
@@ -708,3 +710,4 @@ const cache = onServer | ||
}; | ||
const getCached = (args = {}, { checkCacheBreak = false } = {}) => { | ||
const getCached = (args = {}, options) => { | ||
const { checkCacheBreak = false } = options || {}; | ||
const key = _createKey(ordinal, args); | ||
@@ -803,3 +806,3 @@ let cacheBreakable = false; | ||
} | ||
instantiate({ hydrateSnapshot = null, ssr = false, } = {}) { | ||
instantiate({ hydrateSnapshot, ssr = false, } = {}) { | ||
if (!ssr) { | ||
@@ -806,0 +809,0 @@ const instantiated = new PullstateInstance(this.originStores, false); |
@@ -7,3 +7,3 @@ import React from "react"; | ||
} | ||
export declare const PullstateContext: React.Context<PullstateInstance<IPullstateAllStores>>; | ||
export declare const PullstateContext: React.Context<PullstateInstance<IPullstateAllStores> | null>; | ||
export declare const PullstateProvider: <T extends IPullstateAllStores = IPullstateAllStores>({ instance, children, }: { | ||
@@ -10,0 +10,0 @@ instance: PullstateInstance<T>; |
import { Store } from "./Store"; | ||
export interface IUpdateRef { | ||
shouldUpdate: boolean; | ||
onStoreUpdate: () => void; | ||
onStoreUpdate: (() => void) | null; | ||
getSubState: any; | ||
@@ -6,0 +6,0 @@ currentSubState: any; |
@@ -12,2 +12,2 @@ export interface DeepKeyOfArray<O> extends Array<string | number> { | ||
}; | ||
export declare type DeepTypeOfArray<T, L extends DeepKeyOfArray<T>> = L extends ArrayHasIndex<"0" | "1" | "2" | "3" | "4" | "5" | "6" | "7"> ? any : L extends ArrayHasIndex<"0" | "1" | "2" | "3" | "4" | "5" | "6"> ? T[L["0"]][L["1"]][L["2"]][L["3"]][L["4"]][L["5"]][L["6"]] : L extends ArrayHasIndex<"0" | "1" | "2" | "3" | "4" | "5"> ? T[L["0"]][L["1"]][L["2"]][L["3"]][L["4"]][L["5"]] : L extends ArrayHasIndex<"0" | "1" | "2" | "3" | "4"> ? T[L["0"]][L["1"]][L["2"]][L["3"]][L["4"]] : L extends ArrayHasIndex<"0" | "1" | "2" | "3"> ? T[L["0"]][L["1"]][L["2"]][L["3"]] : L extends ArrayHasIndex<"0" | "1" | "2"> ? T[L["0"]][L["1"]][L["2"]] : L extends ArrayHasIndex<"0" | "1"> ? T[L["0"]][L["1"]] : L extends ArrayHasIndex<"0"> ? T[L["0"]] : never; | ||
export declare type DeepTypeOfArray<T, L extends DeepKeyOfArray<T> | undefined> = L extends ArrayHasIndex<"0" | "1" | "2" | "3" | "4" | "5" | "6" | "7"> ? any : L extends ArrayHasIndex<"0" | "1" | "2" | "3" | "4" | "5" | "6"> ? T[L["0"]][L["1"]][L["2"]][L["3"]][L["4"]][L["5"]][L["6"]] : L extends ArrayHasIndex<"0" | "1" | "2" | "3" | "4" | "5"> ? T[L["0"]][L["1"]][L["2"]][L["3"]][L["4"]][L["5"]] : L extends ArrayHasIndex<"0" | "1" | "2" | "3" | "4"> ? T[L["0"]][L["1"]][L["2"]][L["3"]][L["4"]] : L extends ArrayHasIndex<"0" | "1" | "2" | "3"> ? T[L["0"]][L["1"]][L["2"]][L["3"]] : L extends ArrayHasIndex<"0" | "1" | "2"> ? T[L["0"]][L["1"]][L["2"]] : L extends ArrayHasIndex<"0" | "1"> ? T[L["0"]][L["1"]] : L extends ArrayHasIndex<"0"> ? T[L["0"]] : never; |
{ | ||
"name": "pullstate", | ||
"version": "1.5.0", | ||
"version": "1.5.1", | ||
"description": "Simple state stores using immer and React hooks", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
110439
2160