Rename cache/credentials2 to remove the 2.
As long as we keep the cache key the same, it's fine to change the user facing parts.master
parent
1268564b90
commit
e58f3dd9e6
|
@ -17,8 +17,8 @@ export default function Debug() {
|
|||
const [stateCollectionUid, setCollectionUid] = React.useState("");
|
||||
const [itemsUids, setEntriesUids] = React.useState("");
|
||||
const [result, setResult] = React.useState("");
|
||||
const cacheCollections = useSelector((state: StoreState) => state.cache2.collections);
|
||||
const cacheItems = useSelector((state: StoreState) => state.cache2.items);
|
||||
const cacheCollections = useSelector((state: StoreState) => state.cache.collections);
|
||||
const cacheItems = useSelector((state: StoreState) => state.cache.items);
|
||||
|
||||
function handleInputChange(func: (value: string) => void) {
|
||||
return (event: React.ChangeEvent<any>) => {
|
||||
|
|
|
@ -10,7 +10,7 @@ import * as store from "./store";
|
|||
import { usePromiseMemo } from "./helpers";
|
||||
|
||||
export const credentialsSelector = createSelector(
|
||||
(state: store.StoreState) => state.credentials2.storedSession,
|
||||
(state: store.StoreState) => state.credentials.storedSession,
|
||||
(storedSession) => {
|
||||
if (storedSession) {
|
||||
return Etebase.Account.restore(storedSession);
|
||||
|
|
|
@ -58,7 +58,7 @@ export const getCollectionManager = memoize(function (etebase: Etebase.Account)
|
|||
|
||||
// React specific stuff
|
||||
export function useCollections(etebase: Etebase.Account, colType?: string) {
|
||||
const cachedCollections = useSelector((state: StoreState) => state.cache2.collections);
|
||||
const cachedCollections = useSelector((state: StoreState) => state.cache.collections);
|
||||
return usePromiseMemo(
|
||||
(colType) ?
|
||||
getCollectionsByType(cachedCollections, colType, etebase) :
|
||||
|
@ -68,8 +68,8 @@ export function useCollections(etebase: Etebase.Account, colType?: string) {
|
|||
}
|
||||
|
||||
export function useItems(etebase: Etebase.Account, colType: string) {
|
||||
const cachedCollections = useSelector((state: StoreState) => state.cache2.collections);
|
||||
const cachedItems = useSelector((state: StoreState) => state.cache2.items);
|
||||
const cachedCollections = useSelector((state: StoreState) => state.cache.collections);
|
||||
const cachedItems = useSelector((state: StoreState) => state.cache.items);
|
||||
return usePromiseMemo(
|
||||
getItemsByType(cachedCollections, cachedItems, colType, etebase),
|
||||
[etebase, cachedCollections, cachedItems, colType]
|
||||
|
|
|
@ -18,14 +18,14 @@ import {
|
|||
|
||||
export interface StoreState {
|
||||
fetchCount: number;
|
||||
credentials2: CredentialsData;
|
||||
credentials: CredentialsData;
|
||||
settings: SettingsType;
|
||||
encryptionKey: {key: string};
|
||||
sync: {
|
||||
collections: SyncCollectionsData;
|
||||
general: SyncGeneralData;
|
||||
};
|
||||
cache2: {
|
||||
cache: {
|
||||
collections: CacheCollectionsData;
|
||||
items: CacheItemsData;
|
||||
};
|
||||
|
@ -124,13 +124,13 @@ const cachePersistConfig = {
|
|||
const reducers = combineReducers({
|
||||
fetchCount,
|
||||
settings: persistReducer(settingsPersistConfig, settingsReducer),
|
||||
credentials2: persistReducer(credentialsPersistConfig, credentials),
|
||||
credentials: persistReducer(credentialsPersistConfig, credentials),
|
||||
encryptionKey: persistReducer(encryptionKeyPersistConfig, encryptionKeyReducer),
|
||||
sync: persistReducer(syncPersistConfig, combineReducers({
|
||||
collections: syncCollections,
|
||||
general: syncGeneral,
|
||||
})),
|
||||
cache2: persistReducer(cachePersistConfig, combineReducers({
|
||||
cache: persistReducer(cachePersistConfig, combineReducers({
|
||||
collections,
|
||||
items,
|
||||
})),
|
||||
|
|
Loading…
Reference in New Issue