fix tags key
This commit is contained in:
parent
d4e66b7613
commit
89a2db0613
5 changed files with 22 additions and 13 deletions
14
dist/bundle.es.js
vendored
14
dist/bundle.es.js
vendored
|
@ -1242,6 +1242,10 @@ const isClaimNsfw = claim => {
|
|||
return false;
|
||||
};
|
||||
|
||||
const createNormalizedTagKey = tags => {
|
||||
return tags.sort().join(',');
|
||||
};
|
||||
|
||||
//
|
||||
|
||||
const selectState$1 = state => state.claims || {};
|
||||
|
@ -1521,9 +1525,9 @@ const selectFetchingClaimSearchByTags = reselect.createSelector(selectState$1, s
|
|||
|
||||
const selectClaimSearchUrisByTags = reselect.createSelector(selectState$1, state => state.claimSearchUrisByTags);
|
||||
|
||||
const makeSelectFetchingClaimSearchForTags = tags => reselect.createSelector(selectFetchingClaimSearchByTags, byTags => byTags[tags]);
|
||||
const makeSelectFetchingClaimSearchForTags = tags => reselect.createSelector(selectFetchingClaimSearchByTags, byTags => byTags[createNormalizedTagKey(tags)]);
|
||||
|
||||
const makeSelectClaimSearchUrisForTags = tags => reselect.createSelector(selectClaimSearchUrisByTags, byTags => byTags[tags]);
|
||||
const makeSelectClaimSearchUrisForTags = tags => reselect.createSelector(selectClaimSearchUrisByTags, byTags => byTags[createNormalizedTagKey(tags)]);
|
||||
|
||||
const selectState$2 = state => state.wallet || {};
|
||||
|
||||
|
@ -2353,7 +2357,7 @@ function doClaimSearch(amount = 20, options = {}) {
|
|||
// tags can be one or many (comma separated)
|
||||
function doClaimSearchByTags(tags, amount = 10, options = {}) {
|
||||
return dispatch => {
|
||||
const tagList = tags.join(',');
|
||||
const tagList = createNormalizedTagKey(tags);
|
||||
dispatch({
|
||||
type: CLAIM_SEARCH_BY_TAGS_STARTED,
|
||||
data: { tags: tagList }
|
||||
|
@ -3384,8 +3388,8 @@ const defaultState = {
|
|||
abandoningById: {},
|
||||
pendingById: {},
|
||||
fetchingClaimSearch: false,
|
||||
claimSearchUrisByTags: [],
|
||||
fetchingClaimSearchByTags: [],
|
||||
claimSearchUrisByTags: {},
|
||||
fetchingClaimSearchByTags: {},
|
||||
lastClaimSearchUris: []
|
||||
};
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ import { doFetchTransactions } from 'redux/actions/wallet';
|
|||
import { selectSupportsByOutpoint } from 'redux/selectors/wallet';
|
||||
import { creditsToString } from 'util/formatCredits';
|
||||
import { batchActions } from 'util/batchActions';
|
||||
import { createNormalizedTagKey } from 'util/claim';
|
||||
|
||||
export function doResolveUris(uris: Array<string>, returnCachedClaims: boolean = false) {
|
||||
return (dispatch: Dispatch, getState: GetState) => {
|
||||
|
@ -336,7 +337,7 @@ export function doClaimSearch(amount: number = 20, options: { page?: number } =
|
|||
// tags can be one or many (comma separated)
|
||||
export function doClaimSearchByTags(tags: Array<string>, amount: number = 10, options: { page?: number } = {}) {
|
||||
return (dispatch: Dispatch) => {
|
||||
const tagList = tags.join(',');
|
||||
const tagList = createNormalizedTagKey(tags);
|
||||
dispatch({
|
||||
type: ACTIONS.CLAIM_SEARCH_BY_TAGS_STARTED,
|
||||
data: { tags: tagList },
|
||||
|
|
|
@ -47,8 +47,8 @@ const defaultState = {
|
|||
abandoningById: {},
|
||||
pendingById: {},
|
||||
fetchingClaimSearch: false,
|
||||
claimSearchUrisByTags: [],
|
||||
fetchingClaimSearchByTags: [],
|
||||
claimSearchUrisByTags: {},
|
||||
fetchingClaimSearchByTags: {},
|
||||
lastClaimSearchUris: [],
|
||||
};
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
import { normalizeURI, buildURI, parseURI } from 'lbryURI';
|
||||
import { selectSearchUrisByQuery } from 'redux/selectors/search';
|
||||
import { createSelector } from 'reselect';
|
||||
import { isClaimNsfw } from 'util/claim';
|
||||
import { isClaimNsfw, createNormalizedTagKey } from 'util/claim';
|
||||
import { getSearchQueryString } from 'util/query_params';
|
||||
|
||||
const selectState = state => state.claims || {};
|
||||
|
@ -495,14 +495,14 @@ export const selectClaimSearchUrisByTags = createSelector(
|
|||
state => state.claimSearchUrisByTags
|
||||
);
|
||||
|
||||
export const makeSelectFetchingClaimSearchForTags = (tags: string) =>
|
||||
export const makeSelectFetchingClaimSearchForTags = (tags: Array<string>) =>
|
||||
createSelector(
|
||||
selectFetchingClaimSearchByTags,
|
||||
byTags => byTags[tags]
|
||||
byTags => byTags[createNormalizedTagKey(tags)]
|
||||
);
|
||||
|
||||
export const makeSelectClaimSearchUrisForTags = (tags: string) =>
|
||||
export const makeSelectClaimSearchUrisForTags = (tags: Array<string>) =>
|
||||
createSelector(
|
||||
selectClaimSearchUrisByTags,
|
||||
byTags => byTags[tags]
|
||||
byTags => byTags[createNormalizedTagKey(tags)]
|
||||
);
|
||||
|
|
|
@ -22,3 +22,7 @@ export const isClaimNsfw = (claim: Claim): boolean => {
|
|||
|
||||
return false;
|
||||
};
|
||||
|
||||
export const createNormalizedTagKey = (tags: Array<string>): string => {
|
||||
return tags.sort().join(',');
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue