reactivesearch icon indicating copy to clipboard operation
reactivesearch copied to clipboard

Cannot read property 'dataField' of null at getCompositeAggsQuery

Open embpdaniel opened this issue 6 years ago • 5 comments

Affected Projects React

Library Version: 3.12.4

Describe the bug

I add aggregationField prop to ReactiveList and I get this error:

Uncaught TypeError: Cannot read property 'dataField' of null at getCompositeAggsQuery (helper.js:formatted:535)

To Reproduce

Steps to reproduce the behavior:

Just add a ReactiveList component with aggregationField prop. It will throw the error.

Expected behavior

should not throw error

Additional context The issue that I found is that the ReactiveList component calls the getCompositeAggsQuery function with an incorrect signature when compared to the getCompositeAggsQuery function that comes from reactive core.

Here is what the ReactiveList call looks like:

getAggsQuery = () => {
		const { size, aggregationField, afterKey } = this.props;
		const queryOptions = { size };
		if (aggregationField) {
			queryOptions.aggs = getCompositeAggsQuery(
				{},
				this.props,
				afterKey ? { after: afterKey } : null,
				true,
			).aggs;
		}
		return queryOptions;
	};

Here is what the getCompositeAggsQuery function signature looks like from reactive core:

export const getCompositeAggsQuery = (value, query, props, after, showTopHits = false) => {

As you can see the signatures are not compatible. The props argument is not lining up and we get the error

embpdaniel avatar Sep 11 '20 01:09 embpdaniel

The same bug occurs in ReactiveComponent, CategorySearch, DataSearch web components

grantas33 avatar Sep 25 '20 13:09 grantas33

I'm also encountering this with version 3.13.0.

misspokeycat avatar Nov 08 '20 17:11 misspokeycat

Any updates? Any idea which version works with aggregationField?

infinitodk avatar Nov 27 '20 00:11 infinitodk

Bump! How is this not prioritized?

infinitodk avatar Dec 16 '20 12:12 infinitodk

@infinitodk This issue has been fixed in v3.13.2.

bietkul avatar Dec 22 '20 12:12 bietkul