Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove non-serializable value from payload #5038

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { GoodDataSdkError } from "@gooddata/sdk-ui";
import { Correlation, ILoadElementsOptions, ILoadElementsResult } from "../../../types/index.js";
import { AttributeFilterReducer } from "../store/state.js";
import { getElementCacheKey } from "../common/selectors.js";
import { AttributeFilterHandlerStoreContext } from "../store/types.js";

const loadCustomElementsRequest: AttributeFilterReducer<
PayloadAction<{ options: ILoadElementsOptions; correlation: Correlation | undefined }>
Expand All @@ -20,16 +19,16 @@ const loadCustomElementsSuccess: AttributeFilterReducer<
PayloadAction<
ILoadElementsResult & {
correlation?: Correlation;
context: AttributeFilterHandlerStoreContext;
enableDuplicatedLabelValuesInAttributeFilter: boolean;
}
>
> = (state, action) => {
const keys = [];

const { context } = action.payload;
const { enableDuplicatedLabelValuesInAttributeFilter } = action.payload;

action.payload.elements.forEach((el) => {
const cacheKey = getElementCacheKey(state, el, context.enableDuplicatedLabelValuesInAttributeFilter);
const cacheKey = getElementCacheKey(state, el, enableDuplicatedLabelValuesInAttributeFilter);
if (!state.elements.cache[cacheKey]) {
state.elements.cache[cacheKey] = el;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,14 @@ export function* loadCustomElementsSaga(
});

if (result) {
yield put(actions.loadCustomElementsSuccess({ ...result, correlation, context }));
yield put(
actions.loadCustomElementsSuccess({
...result,
correlation,
enableDuplicatedLabelValuesInAttributeFilter:
context.enableDuplicatedLabelValuesInAttributeFilter,
}),
);
return result;
} else if (canceled || anotherRequest) {
yield put(actions.loadCustomElementsCancel({ correlation }));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import identity from "lodash/identity.js";
import { Correlation, ILoadElementsResult } from "../../../types/index.js";
import { getElementCacheKey } from "../common/selectors.js";
import { AttributeFilterReducer } from "../store/state.js";
import { AttributeFilterHandlerStoreContext } from "../store/types.js";

const loadInitialElementsPageRequest: AttributeFilterReducer<PayloadAction<{ correlation: Correlation }>> =
identity;
Expand All @@ -25,21 +24,21 @@ const loadInitialElementsPageSuccess: AttributeFilterReducer<
PayloadAction<
ILoadElementsResult & {
correlation: Correlation;
context: AttributeFilterHandlerStoreContext;
enableDuplicatedLabelValuesInAttributeFilter: boolean;
}
>
> = (state, action) => {
const { context } = action.payload;
const { enableDuplicatedLabelValuesInAttributeFilter } = action.payload;
state.elements.initialPageLoad.status = "success";
state.elements.totalCountWithCurrentSettings = action.payload.totalCount;
action.payload.elements.forEach((el) => {
const cacheKey = getElementCacheKey(state, el, context.enableDuplicatedLabelValuesInAttributeFilter);
const cacheKey = getElementCacheKey(state, el, enableDuplicatedLabelValuesInAttributeFilter);
if (!state.elements.cache[cacheKey]) {
state.elements.cache[cacheKey] = el;
}
});
state.elements.data = action.payload.elements.map((el) =>
getElementCacheKey(state, el, context.enableDuplicatedLabelValuesInAttributeFilter),
getElementCacheKey(state, el, enableDuplicatedLabelValuesInAttributeFilter),
);
state.elements.lastLoadedOptions = action.payload.options;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,14 @@ export function* loadInitialElementsPageSaga(
actions.setLimitingAttributeFiltersAttributes({ attributes: limitingAttributeFiltersAttributes }),
);
yield put(actions.setCacheId({ cacheId: result.cacheId }));
yield put(actions.loadInitialElementsPageSuccess({ ...result, correlation, context }));
yield put(
actions.loadInitialElementsPageSuccess({
...result,
correlation,
enableDuplicatedLabelValuesInAttributeFilter:
context.enableDuplicatedLabelValuesInAttributeFilter,
}),
);
} catch (error) {
yield put(
actions.loadInitialElementsPageError({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import identity from "lodash/identity.js";
import { Correlation, ILoadElementsResult } from "../../../types/index.js";
import { getElementCacheKey } from "../common/selectors.js";
import { AttributeFilterReducer } from "../store/state.js";
import { AttributeFilterHandlerStoreContext } from "../store/types.js";

const loadNextElementsPageRequest: AttributeFilterReducer<PayloadAction<{ correlation: Correlation }>> =
identity;
Expand All @@ -22,21 +21,21 @@ const loadNextElementsPageSuccess: AttributeFilterReducer<
PayloadAction<
ILoadElementsResult & {
correlation: Correlation;
context: AttributeFilterHandlerStoreContext;
enableDuplicatedLabelValuesInAttributeFilter: boolean;
}
>
> = (state, action) => {
const { context } = action.payload;
const { enableDuplicatedLabelValuesInAttributeFilter } = action.payload;
state.elements.nextPageLoad.status = "success";
action.payload.elements.forEach((el) => {
const cacheKey = getElementCacheKey(state, el, context.enableDuplicatedLabelValuesInAttributeFilter);
const cacheKey = getElementCacheKey(state, el, enableDuplicatedLabelValuesInAttributeFilter);
if (!state.elements.cache[cacheKey]) {
state.elements.cache[cacheKey] = el;
}
});
state.elements.data = state.elements.data.concat(
action.payload.elements.map((el) =>
getElementCacheKey(state, el, context.enableDuplicatedLabelValuesInAttributeFilter),
getElementCacheKey(state, el, enableDuplicatedLabelValuesInAttributeFilter),
),
);
state.elements.lastLoadedOptions = action.payload.options;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,14 @@ export function* loadNextElementsPageSaga(

const result = yield call(elementsSaga, loadOptionsWithExcludePrimaryLabel, cacheId);

yield put(actions.loadNextElementsPageSuccess({ ...result, correlation, context }));
yield put(
actions.loadNextElementsPageSuccess({
...result,
correlation,
enableDuplicatedLabelValuesInAttributeFilter:
context.enableDuplicatedLabelValuesInAttributeFilter,
}),
);
} catch (error) {
yield put(
actions.loadNextElementsPageError({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,72 +29,6 @@ exports[`AttributeFilterHandler > loadCustomElements() that was successful shoul
[
{
"cacheId": undefined,
"context": {
"attributeFilter": {
"positiveAttributeFilter": {
"displayForm": {
"identifier": "label.f_product.product.name",
"type": "displayForm",
},
"in": {
"uris": [
"/gdc/md/referenceworkspace/obj/1054/elements?id=165678",
"/gdc/md/referenceworkspace/obj/1054/elements?id=165847",
],
},
},
},
"backend": {
"authenticate": [Function],
"capabilities": {
"allowsInconsistentRelations": false,
"canCalculateGrandTotals": true,
"canCalculateNativeTotals": true,
"canCalculateSubTotals": true,
"canCalculateTotals": true,
"supportsCsvUploader": true,
"supportsCustomColorPalettes": true,
"supportsElementUris": true,
"supportsElementsQueryParentFiltering": true,
"supportsEveryoneUserGroupForAccessControl": true,
"supportsHierarchicalWorkspaces": false,
"supportsKpiWidget": false,
"supportsOwners": true,
"supportsWidgetEntity": true,
},
"config": {
"attributeElementsFiltering": {
"attributeFilters": {
"label.f_product.product.name": [Function],
},
"dateFilters": {
"dt_snapshotdate_timestamp.day": [Function],
},
"measures": {
"87a053b0-3947-49f3-b0c5-de53fd01f050": [Function],
},
},
},
"currentUser": [Function],
"dataSources": [Function],
"deauthenticate": [Function],
"entitlements": [Function],
"isAuthenticated": [Function],
"onHostname": [Function],
"organization": [Function],
"organizations": [Function],
"withAuthentication": [Function],
"withTelemetry": [Function],
"workspace": [Function],
"workspaces": [Function],
},
"displayAsLabel": undefined,
"enableDuplicatedLabelValuesInAttributeFilter": undefined,
"eventListener": [Function],
"hiddenElements": undefined,
"staticElements": undefined,
"workspace": "testWorkspace",
},
"correlation": "success",
"elements": [
{
Expand Down Expand Up @@ -126,6 +60,7 @@ exports[`AttributeFilterHandler > loadCustomElements() that was successful shoul
"uri": "WonderKid",
},
],
"enableDuplicatedLabelValuesInAttributeFilter": undefined,
"options": {},
"totalCount": 7,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,72 +184,6 @@ exports[`AttributeFilterHandler > loadInitialElementsPage() that was successful
[
{
"cacheId": undefined,
"context": {
"attributeFilter": {
"positiveAttributeFilter": {
"displayForm": {
"identifier": "label.f_product.product.name",
"type": "displayForm",
},
"in": {
"uris": [
"/gdc/md/referenceworkspace/obj/1054/elements?id=165678",
"/gdc/md/referenceworkspace/obj/1054/elements?id=165847",
],
},
},
},
"backend": {
"authenticate": [Function],
"capabilities": {
"allowsInconsistentRelations": false,
"canCalculateGrandTotals": true,
"canCalculateNativeTotals": true,
"canCalculateSubTotals": true,
"canCalculateTotals": true,
"supportsCsvUploader": true,
"supportsCustomColorPalettes": true,
"supportsElementUris": true,
"supportsElementsQueryParentFiltering": true,
"supportsEveryoneUserGroupForAccessControl": true,
"supportsHierarchicalWorkspaces": false,
"supportsKpiWidget": false,
"supportsOwners": true,
"supportsWidgetEntity": true,
},
"config": {
"attributeElementsFiltering": {
"attributeFilters": {
"label.f_product.product.name": [Function],
},
"dateFilters": {
"dt_snapshotdate_timestamp.day": [Function],
},
"measures": {
"87a053b0-3947-49f3-b0c5-de53fd01f050": [Function],
},
},
},
"currentUser": [Function],
"dataSources": [Function],
"deauthenticate": [Function],
"entitlements": [Function],
"isAuthenticated": [Function],
"onHostname": [Function],
"organization": [Function],
"organizations": [Function],
"withAuthentication": [Function],
"withTelemetry": [Function],
"workspace": [Function],
"workspaces": [Function],
},
"displayAsLabel": undefined,
"enableDuplicatedLabelValuesInAttributeFilter": undefined,
"eventListener": [Function],
"hiddenElements": undefined,
"staticElements": undefined,
"workspace": "testWorkspace",
},
"correlation": "success",
"elements": [
{
Expand Down Expand Up @@ -281,6 +215,7 @@ exports[`AttributeFilterHandler > loadInitialElementsPage() that was successful
"uri": "WonderKid",
},
],
"enableDuplicatedLabelValuesInAttributeFilter": undefined,
"options": {
"excludePrimaryLabel": false,
"limit": 500,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,72 +69,6 @@ exports[`AttributeFilterHandler > loadNextElementsPage() that was successful sho
[
{
"cacheId": undefined,
"context": {
"attributeFilter": {
"positiveAttributeFilter": {
"displayForm": {
"identifier": "label.f_product.product.name",
"type": "displayForm",
},
"in": {
"uris": [
"/gdc/md/referenceworkspace/obj/1054/elements?id=165678",
"/gdc/md/referenceworkspace/obj/1054/elements?id=165847",
],
},
},
},
"backend": {
"authenticate": [Function],
"capabilities": {
"allowsInconsistentRelations": false,
"canCalculateGrandTotals": true,
"canCalculateNativeTotals": true,
"canCalculateSubTotals": true,
"canCalculateTotals": true,
"supportsCsvUploader": true,
"supportsCustomColorPalettes": true,
"supportsElementUris": true,
"supportsElementsQueryParentFiltering": true,
"supportsEveryoneUserGroupForAccessControl": true,
"supportsHierarchicalWorkspaces": false,
"supportsKpiWidget": false,
"supportsOwners": true,
"supportsWidgetEntity": true,
},
"config": {
"attributeElementsFiltering": {
"attributeFilters": {
"label.f_product.product.name": [Function],
},
"dateFilters": {
"dt_snapshotdate_timestamp.day": [Function],
},
"measures": {
"87a053b0-3947-49f3-b0c5-de53fd01f050": [Function],
},
},
},
"currentUser": [Function],
"dataSources": [Function],
"deauthenticate": [Function],
"entitlements": [Function],
"isAuthenticated": [Function],
"onHostname": [Function],
"organization": [Function],
"organizations": [Function],
"withAuthentication": [Function],
"withTelemetry": [Function],
"workspace": [Function],
"workspaces": [Function],
},
"displayAsLabel": undefined,
"enableDuplicatedLabelValuesInAttributeFilter": undefined,
"eventListener": [Function],
"hiddenElements": undefined,
"staticElements": undefined,
"workspace": "testWorkspace",
},
"correlation": "success",
"elements": [
{
Expand All @@ -146,6 +80,7 @@ exports[`AttributeFilterHandler > loadNextElementsPage() that was successful sho
"uri": "Grammar Plus",
},
],
"enableDuplicatedLabelValuesInAttributeFilter": undefined,
"options": {
"excludePrimaryLabel": false,
"limit": 2,
Expand Down
Loading