lint
This commit is contained in:
parent
13cd56dabc
commit
c0db949a53
7 changed files with 53 additions and 38 deletions
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* How to use this file:
|
||||
* Settings exported from here will trigger the setting to be
|
||||
* sent to the preference middleware when set using the
|
||||
* usual setDaemonSettings and clearDaemonSettings methods.
|
||||
*
|
||||
* See redux/settings/actions in the app for where this is used.
|
||||
* How to use this file:
|
||||
* Settings exported from here will trigger the setting to be
|
||||
* sent to the preference middleware when set using the
|
||||
* usual setDaemonSettings and clearDaemonSettings methods.
|
||||
*
|
||||
* See redux/settings/actions in the app for where this is used.
|
||||
*/
|
||||
|
||||
import * as DAEMON_SETTINGS from './daemon_settings';
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
// @flow
|
||||
import * as ACTIONS from 'constants/action_types';
|
||||
|
||||
export function savePosition(claimId: string, outpoint: string, position: number) {
|
||||
return dispatch => {
|
||||
return (dispatch: Dispatch) => {
|
||||
dispatch({
|
||||
type: ACTIONS.SET_CONTENT_POSITION,
|
||||
data: { claimId, outpoint, position },
|
||||
|
|
|
@ -14,7 +14,7 @@ type SharedData = {
|
|||
|
||||
function extractUserState(rawObj: SharedData) {
|
||||
if (rawObj && rawObj.version === '0.1' && rawObj.value) {
|
||||
const { subscriptions, tags, blocked, settings} = rawObj.value;
|
||||
const { subscriptions, tags, blocked, settings } = rawObj.value;
|
||||
|
||||
return {
|
||||
...(subscriptions ? { subscriptions } : {}),
|
||||
|
@ -30,7 +30,10 @@ function extractUserState(rawObj: SharedData) {
|
|||
export function doPopulateSharedUserState(sharedSettings: any) {
|
||||
return (dispatch: Dispatch) => {
|
||||
const { subscriptions, tags, blocked, settings } = extractUserState(sharedSettings);
|
||||
dispatch({ type: ACTIONS.USER_STATE_POPULATE, data: { subscriptions, tags, blocked, settings } });
|
||||
dispatch({
|
||||
type: ACTIONS.USER_STATE_POPULATE,
|
||||
data: { subscriptions, tags, blocked, settings },
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -33,8 +33,7 @@ export const blockedReducer = handleActions(
|
|||
const { blocked } = action.data;
|
||||
return {
|
||||
...state,
|
||||
blockedChannels:
|
||||
blocked && blocked.length ? blocked : state.blockedChannels,
|
||||
blockedChannels: blocked && blocked.length ? blocked : state.blockedChannels,
|
||||
};
|
||||
},
|
||||
},
|
||||
|
|
|
@ -265,7 +265,8 @@ reducers[ACTIONS.FETCH_CHANNEL_CLAIMS_COMPLETED] = (state: State, action: any):
|
|||
const paginatedClaimsByChannel = Object.assign({}, state.paginatedClaimsByChannel);
|
||||
// check if count has changed - that means cached pagination will be wrong, so clear it
|
||||
const previousCount = paginatedClaimsByChannel[uri] && paginatedClaimsByChannel[uri]['itemCount'];
|
||||
const byChannel = (claimsInChannel === previousCount) ? Object.assign({}, paginatedClaimsByChannel[uri]) : {};
|
||||
const byChannel =
|
||||
claimsInChannel === previousCount ? Object.assign({}, paginatedClaimsByChannel[uri]) : {};
|
||||
const allClaimIds = new Set(byChannel.all);
|
||||
const currentPageClaimIds = [];
|
||||
const byId = Object.assign({}, state.byId);
|
||||
|
|
|
@ -1,14 +1,19 @@
|
|||
// @flow
|
||||
import { createSelector } from 'reselect';
|
||||
import { makeSelectClaimForUri } from 'redux/selectors/claims';
|
||||
|
||||
export const selectState = (state: any) => state.content || {};
|
||||
|
||||
export const makeSelectContentPositionForUri = (uri: string) =>
|
||||
createSelector(selectState, makeSelectClaimForUri(uri), (state, claim) => {
|
||||
if (!claim) {
|
||||
return null;
|
||||
createSelector(
|
||||
selectState,
|
||||
makeSelectClaimForUri(uri),
|
||||
(state, claim) => {
|
||||
if (!claim) {
|
||||
return null;
|
||||
}
|
||||
const outpoint = `${claim.txid}:${claim.nout}`;
|
||||
const id = claim.claim_id;
|
||||
return state.positions[id] ? state.positions[id][outpoint] : null;
|
||||
}
|
||||
const outpoint = `${claim.txid}:${claim.nout}`;
|
||||
const id = claim.claim_id;
|
||||
return state.positions[id] ? state.positions[id][outpoint] : null;
|
||||
});
|
||||
);
|
||||
|
|
|
@ -1,26 +1,32 @@
|
|||
import { createSelector } from 'reselect';
|
||||
|
||||
export const selectState = (state) => state.notifications || {};
|
||||
export const selectState = state => state.notifications || {};
|
||||
|
||||
export const selectToast = createSelector(selectState, (state) => {
|
||||
if (state.toasts.length) {
|
||||
const { id, params } = state.toasts[0];
|
||||
return {
|
||||
id,
|
||||
...params,
|
||||
};
|
||||
export const selectToast = createSelector(
|
||||
selectState,
|
||||
state => {
|
||||
if (state.toasts.length) {
|
||||
const { id, params } = state.toasts[0];
|
||||
return {
|
||||
id,
|
||||
...params,
|
||||
};
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
);
|
||||
|
||||
return null;
|
||||
});
|
||||
export const selectError = createSelector(
|
||||
selectState,
|
||||
state => {
|
||||
if (state.errors.length) {
|
||||
const { error } = state.errors[0];
|
||||
return {
|
||||
error,
|
||||
};
|
||||
}
|
||||
|
||||
export const selectError = createSelector(selectState, (state) => {
|
||||
if (state.errors.length) {
|
||||
const { error } = state.errors[0];
|
||||
return {
|
||||
error,
|
||||
};
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
});
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue