Migrating from RAQB

From react-awesome-query-builder's config and Immutable tree to a typed schema and plain JSON.

Keep stored RAQB trees working with the raqb format: value / onChange read and write RAQB's JSON tree (QbUtils.getTree output), including rule_group array groups, functions mapped to RAQB's BasicFuncs, and locks.

import { QueryBuilder } from '@qnot/react';
import { raqb } from '@qnot/core/formats/raqb';

<QueryBuilder fields={fields} format={raqb} value={tree} onChange={setTree} />;

There's no Immutable.js and no Redux store: the value is plain JSON.

Config to schema

Exports

QbUtils.sqlFormat, mongodbFormat, jsonLogicFormat, spelFormat, elasticSearchFormat and queryString map to the sql, mongo, jsonlogic, spel, elasticsearch and text codecs. loadFromJsonLogic, loadFromSpel and SqlUtils.loadFromSql map to decode with those codecs.

Not carried over

  • Custom conjunctions (XOR, NOR). NOR is NOT + OR; XOR has no portable meaning in SQL or MongoDB.
  • validateValue returning a fixedValue. Validation reports; it doesn't rewrite values.
  • Slider marks, rows for textareas, price formatting options. The schema carries widget, step, prefix and suffix; anything more goes in meta for your UI.
  • RAQB's antd / MUI / Bootstrap / Fluent widget packages. Build the UI from the hooks with your kit instead.

Speed

At 1,000 rules, adding a rule drops from about 95 ms to 1.5 ms, a keystroke from about 8 ms to 0.4 ms, first render from about 590 ms to 120 ms, and the JavaScript from 193 KB to about 22 KB gzipped, both counting their SQL export (see the benchmarks).