signatureOf()
signatureOf(
prev:RuleGroupTypeAny,next:RuleGroupTypeAny):string
Defined in: packages/core/src/utils/signature.ts:109
Describes what changed between two versions of a query as a short string, so that consecutive edits to the same property of the same rule (e.g. typing in a value editor) can be recognized and coalesced into a single history entry.
Returns structuralSignature for changes to the shape of the query, unchangedSignature when the
two queries differ by reference only, and "<id>:<props>" otherwise.
The walk prunes on reference equality, so it costs O(depth) rather than O(size) for the single-node edits that make up the overwhelming majority of changes.
Note that this relies on the structural sharing that Immer—and therefore every query produced by RQB's own update functions—guarantees: nodes that did not change keep their identity. A query that has been wholly rebuilt (deep-cloned, round-tripped through JSON, re-parsed from a string) shares no identity with its predecessor, so it is reported as structuralSignature and will not coalesce. That is a graceful degradation—every change simply gets its own history entry—but controlled components that clone the query on every change will not benefit from coalescing.
Parameters
| Parameter | Type |
|---|---|
prev | RuleGroupTypeAny |
next | RuleGroupTypeAny |
Returns
string
API documentation is generated from the latest commit on the main branch. It may be somewhat inconsistent with official releases of React Query Builder.