shouldCoalesce()
shouldCoalesce(
prevSig:string|undefined,nextSig:string,prevAt:number,now:number,coalesceMs?:number):boolean
Defined in: packages/core/src/utils/coalesce.ts:24
Determines whether a change should be absorbed into the current history entry instead of pushing a new one. This is the exact rule QueryManager applies when recording history, exposed so non-React implementations can manage their own history stacks without reimplementing (and drifting from) the semantics.
A change coalesces only when all three hold:
- the change is not structural (rules/groups added, removed, moved, or reordered)
- its signature matches the previously recorded signature
- it occurred within
coalesceMsof the previous recording
Note that unchangedSignature is not handled here. A change with no observable difference is never recorded at all, which is a separate decision made before this check.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
prevSig | string | undefined | undefined | Signature of the previously recorded change, or undefined if there is none. |
nextSig | string | undefined | Signature of the change being recorded, from signatureOf. |
prevAt | number | undefined | Timestamp of the previous recording. |
now | number | undefined | Timestamp of the change being recorded. |
coalesceMs | number | defaultCoalesceMs | Coalescing window in milliseconds. |
Returns
boolean
API documentation is generated from the latest commit on the main branch. It may be somewhat inconsistent with official releases of React Query Builder.