You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Error happens when the config.conjuntions only contains custom conditions. If a group is created, the jsonLogicFormat() function throws an error.
Then create a group in the query builder and call jsonLogicFormat() function.
Expected behavior
To not throw an error
Additional context
I found different options to fix this.
One is defining in the settings the undocumented option to:
defaultGroupConjunction: "add"
An alternative, transparent to the user, would be to add in the function defaultGroupConjuntion in defaultUtils:
var defaultGroupConjunction = exports.defaultGroupConjunction = function defaultGroupConjunction(config) {
var groupFieldConfig = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
groupFieldConfig = (0, _configUtils.getFieldConfig)(config, groupFieldConfig); // if `groupFieldConfig` is field name, not config
var conjs = groupFieldConfig && groupFieldConfig.conjunctions || Object.keys(config.conjunctions);
if (conjs.length == 1) return conjs[0];
// Line to add
if (conjs.length !== 0 && !conjs.includes(config.settings.defaultGroupConjunction)) return conjs[0];
// End of line to add
return config.settings.defaultGroupConjunction || config.settings.defaultConjunction || conjs[0];
};
Happy to create a pull request if this is of any help.
The text was updated successfully, but these errors were encountered:
Describe the bug
Error happens when the config.conjuntions only contains custom conditions. If a group is created, the jsonLogicFormat() function throws an error.
To Reproduce
create a config:
Then create a group in the query builder and call jsonLogicFormat() function.
Expected behavior
To not throw an error
Additional context
I found different options to fix this.
One is defining in the settings the undocumented option to:
defaultGroupConjunction: "add"
An alternative, transparent to the user, would be to add in the function defaultGroupConjuntion in defaultUtils:
Happy to create a pull request if this is of any help.
The text was updated successfully, but these errors were encountered: