Skip to main content
cngx-src documentation

ReorderCommitHandler

Interface

projects/forms/select/shared/reorder-commit-handler.ts

Import#

import { ReorderCommitHandler } from '@cngx/forms/select'

Description#

API returned from createReorderCommitHandler.

Index#

Methods

Methods#

dispatch#void
dispatch(next: T[], previous: T[], fromIndex: number, toIndex: number, option: CngxSelectOptionDef<T> | null)

Run a reorder through the commit flow.

  • No commit: write values, fire onReorder + onAnnounce.
  • Optimistic: write, emit, begin commit. Success reconciles with the server's canonicalised value; error rolls back.
  • Pessimistic: hold values, emit 'pending', begin commit. Success writes + emits; error leaves values untouched.

Always writes on success regardless of same-membership - the point of this factory is to bypass sameArrayContents.

@paramnextT[]
@parampreviousT[]
@paramfromIndexnumber
@paramtoIndexnumber