wappsto-blanket
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -1,20 +0,21 @@ | ||
export { default as useEntitySelector } from './useAlwaysSubscribe'; | ||
export { default as useEntitySelector } from './useEntitiesSelector'; | ||
export { default as useAlwaysSubscribe } from './useAlwaysSubscribe'; | ||
export { default as useEntitiesSelector } from './useEntitiesSelector'; | ||
export { default as useEntitySelector } from './useEntitySelector'; | ||
export { default as useEntitySelector } from './useFetchItems'; | ||
export { default as useEntitySelector } from './useIds'; | ||
export { default as useEntitySelector } from './useItemSelector'; | ||
export { default as useEntitySelector } from './useList'; | ||
export { default as useEntitySelector } from './useLogs'; | ||
export { default as useEntitySelector } from './useMetrics'; | ||
export { default as useEntitySelector } from './useMountedRef'; | ||
export { default as useEntitySelector } from './usePagination'; | ||
export { default as useEntitySelector } from './usePathSubscribe'; | ||
export { default as useEntitySelector } from './usePrevious'; | ||
export { default as useEntitySelector } from './useRefresh'; | ||
export { default as useEntitySelector } from './useRefreshTimestamp'; | ||
export { default as useEntitySelector } from './useRequest'; | ||
export { default as useEntitySelector } from './useStoreItem'; | ||
export { default as useEntitySelector } from './useStorePagination'; | ||
export { default as useEntitySelector } from './useSubscribe'; | ||
export { default as useEntitySelector } from './useVisible'; | ||
export { default as useFetchItems } from './useFetchItems'; | ||
export { default as useIds } from './useIds'; | ||
export { default as useItemSelector } from './useItemSelector'; | ||
export { default as useList } from './useList'; | ||
export { default as useLogs } from './useLogs'; | ||
export { default as useMetrics } from './useMetrics'; | ||
export { default as useMountedRef } from './useMountedRef'; | ||
export { default as usePagination } from './usePagination'; | ||
export { default as usePathSubscribe } from './usePathSubscribe'; | ||
export { default as usePrevious } from './usePrevious'; | ||
export { default as useRefresh } from './useRefresh'; | ||
export { default as useRefreshTimestamp } from './useRefreshTimestamp'; | ||
export { default as useRequest } from './useRequest'; | ||
export { default as useStoreItem } from './useStoreItem'; | ||
export { default as useStorePagination } from './useStorePagination'; | ||
export { default as useSubscribe } from './useSubscribe'; | ||
export { default as useVisible } from './useVisible'; | ||
export { default as useUser } from './useUser'; |
@@ -5,4 +5,7 @@ import { useMemo, useEffect } from 'react'; | ||
import { updateStream } from '../util'; | ||
import { onLogout } from 'wappsto-redux/events'; | ||
const alwaysSubscribedCache = {}; | ||
let cache = {}; | ||
onLogout(() => cache = {}); | ||
const useAlwaysSubscribe = (items) => { | ||
@@ -15,4 +18,4 @@ const dispatch = useDispatch(); | ||
const itemPath = '/' + item.meta.type + '/' + item.meta.id; | ||
if(!alwaysSubscribedCache[itemPath]){ | ||
alwaysSubscribedCache[itemPath] = true; | ||
if(!cache[itemPath]){ | ||
cache[itemPath] = true; | ||
result.push(itemPath); | ||
@@ -30,3 +33,3 @@ } | ||
prevArr.forEach(itemPath => { | ||
delete alwaysSubscribedCache[itemPath]; | ||
delete cache[itemPath]; | ||
}); | ||
@@ -33,0 +36,0 @@ updateStream(dispatch, prevArr, 'remove'); |
@@ -12,6 +12,9 @@ import { useState, useRef, useCallback, useMemo } from 'react'; | ||
import equal from 'deep-equal'; | ||
import { onLogout } from 'wappsto-redux/events'; | ||
const itemName = 'useIds_status'; | ||
const cache = {}; | ||
let cache = {}; | ||
onLogout(() => cache = {}); | ||
const setCacheStatus = (dispatch, ids, status, query) => { | ||
@@ -18,0 +21,0 @@ ids.forEach(id => cache[id] = { status, query }); |
@@ -30,3 +30,2 @@ import { useState, useEffect, useCallback, useRef, useMemo } from 'react'; | ||
const empty = []; | ||
const requestIdCache = {}; | ||
function useList(props){ | ||
@@ -104,3 +103,3 @@ const dispatch = useDispatch(); | ||
const savedIds = useSelector(state => getSavedIdsItem(state, idsItemName)) || empty; | ||
const { request, send } = useRequest(requestIdName, true); | ||
const { request, send } = useRequest(requestIdName); | ||
@@ -107,0 +106,0 @@ if(propsData.url && !request && customRequest.status !== 'pending'){ |
@@ -8,2 +8,3 @@ import { useState, useRef, useCallback, useEffect } from 'react'; | ||
import equal from 'deep-equal'; | ||
import { onLogout } from 'wappsto-redux/events'; | ||
@@ -20,3 +21,4 @@ const CancelToken = axios.CancelToken; | ||
const cache = {}; | ||
let cache = {}; | ||
onLogout(() => cache = {}); | ||
@@ -23,0 +25,0 @@ function useLogs(stateId, sessionId, cacheId){ |
@@ -6,9 +6,14 @@ import { useState, useEffect, useRef } from 'react'; | ||
import { getSession } from 'wappsto-redux/selectors/session'; | ||
import { onLogout } from 'wappsto-redux/events'; | ||
const MAX_PER_PAGE = 10; | ||
const cache = { | ||
let cache = { | ||
countRequests: {}, | ||
pageRequests: {} | ||
} | ||
onLogout(() => cache = { | ||
countRequests: {}, | ||
pageRequests: {} | ||
}); | ||
@@ -15,0 +20,0 @@ const computeUrl = (url, query, pageSize) => { |
import { useMemo, useEffect } from 'react'; | ||
import { useDispatch } from 'react-redux'; | ||
import { updateStream } from '../util'; | ||
import { onLogout } from 'wappsto-redux/events'; | ||
const pathSubscribedCache = {}; | ||
let cache = {}; | ||
onLogout(() => cache = {}); | ||
const usePathSubscribe = (items, cacheId) => { | ||
@@ -13,3 +16,3 @@ const dispatch = useDispatch(); | ||
useEffect(() => { | ||
if(!pathSubscribedCache[cacheId]){ | ||
if(!cache[cacheId]){ | ||
updateStream(dispatch, arr.map(item => '/' + item.meta.type + '/' + item.meta.id), 'add'); | ||
@@ -20,3 +23,3 @@ } | ||
updateStream(dispatch, arr.map(item => '/' + item.meta.type + '/' + item.meta.id), 'remove'); | ||
delete pathSubscribedCache[cacheId]; | ||
delete cache[cacheId]; | ||
} | ||
@@ -23,0 +26,0 @@ } |
{ | ||
"name": "wappsto-blanket", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "scripts": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
49500
1451