feat(fluxWizard): propagare values limit to redux state
parent
ab0060d19d
commit
751c065bcc
|
|
@ -148,14 +148,16 @@ export function setKeys(
|
|||
export function setValues(
|
||||
tagIndex: number,
|
||||
values: string[],
|
||||
truncated: boolean
|
||||
truncated: boolean,
|
||||
limit: number
|
||||
) {
|
||||
return {
|
||||
type: 'FQB_TAG_VALUES' as const,
|
||||
payload: {
|
||||
tagIndex,
|
||||
values,
|
||||
valuesTruncated: truncated,
|
||||
truncated,
|
||||
limit,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -184,7 +184,14 @@ const loadTagSelectorValuesThunk = (
|
|||
selectedValues = tagState.tagValues.filter(x => values.includes(x))
|
||||
}
|
||||
|
||||
dispatch(tagActions.setValues(tagIndex, values, valuesTruncated))
|
||||
dispatch(
|
||||
tagActions.setValues(
|
||||
tagIndex,
|
||||
values,
|
||||
valuesTruncated,
|
||||
tagState.valuesLimit
|
||||
)
|
||||
)
|
||||
if (selectedValues !== originalSelected) {
|
||||
dispatch(tagActions.selectValues(tagIndex, selectedValues))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ export function initialSelectorState(
|
|||
valuesStatus: undefined,
|
||||
valuesTruncated: false,
|
||||
tagValues: [],
|
||||
valuesLimit: FQB_RESULTS_LIMIT,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -139,7 +140,8 @@ const aggregationReducer = (
|
|||
return changeTagSelector(state, action.payload.tagIndex, () => ({
|
||||
values: action.payload.values,
|
||||
valuesStatus: RemoteDataState.Done,
|
||||
valuesTruncated: action.payload.valuesTruncated,
|
||||
valuesTruncated: action.payload.truncated,
|
||||
valuesLimit: action.payload.limit,
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ export interface TagSelectorState extends BuilderTagsType {
|
|||
valuesStatus?: RemoteDataState
|
||||
values: string[]
|
||||
valuesTruncated: boolean
|
||||
valuesLimit: number
|
||||
}
|
||||
|
||||
export interface BuilderTagsType {
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ describe('fluxQueryBuilder/reducers/tags', () => {
|
|||
;[true, false].forEach(truncated => {
|
||||
const newVal = ['newV']
|
||||
const state = [initialSelectorState(0), initialSelectorState(1)]
|
||||
const reducedState = reducer(state, setValues(1, newVal, truncated))
|
||||
const reducedState = reducer(state, setValues(1, newVal, truncated, 400))
|
||||
expect(reducedState).toEqual([
|
||||
state[0],
|
||||
{
|
||||
|
|
@ -131,6 +131,7 @@ describe('fluxQueryBuilder/reducers/tags', () => {
|
|||
values: newVal,
|
||||
valuesTruncated: truncated,
|
||||
valuesStatus: RemoteDataState.Done,
|
||||
valuesLimit: 400,
|
||||
},
|
||||
])
|
||||
expect(Object.is(state, reducedState)).toBe(false)
|
||||
|
|
|
|||
Loading…
Reference in New Issue