AfterChangeProps
Defined in: packages/core/src/collections/hooks.ts:44
Arguments passed to a collection’s afterChange hook.
On a versioned collection (versions.drafts: true) this fires for EVERY
row write, draft rows included — saveDraft’s bootstrap insert and
patches, publish’s promotion, unpublish’s status flip. newDoc.vex_status
tells them apart; the hook decides what it cares about. operation
describes the ROW (a bootstrapped draft row is "create"). publish
deleting a draft row fires afterDelete with that row as oldDoc — check
oldDoc.vex_status === "draft" to ignore it.
Extends
Section titled “Extends”BaseHookProps<TDataModel>
Type Parameters
Section titled “Type Parameters”TCollectionSlug
Section titled “TCollectionSlug”TCollectionSlug extends CollectionSlug = CollectionSlug
TDataModel
Section titled “TDataModel”TDataModel extends GenericDataModel = GenericDataModel
Properties
Section titled “Properties”collection
Section titled “collection”collection:
CollectionConfig<{ }, { },TCollectionSlug>
Defined in: packages/core/src/collections/hooks.ts:53
The resolved config of the collection this write ran on.
commitTs
Section titled “commitTs”commitTs:
unknown
Defined in: packages/core/src/hooks/types.ts:29
This write’s unresolved ctx.db.vars.commitTs placeholder — the same
value stampCommitTsFields writes into a matching commitTs() field.
A hook MAY use it to stamp a RELATED document in the same mutation
(e.g. a parent row’s own commitTs field). It is NOT the resolved
value — Convex resolves a commitTs placeholder only after the
mutation commits, so reading it as a number/bigint here throws or
returns the placeholder object itself, never a usable timestamp.
Inherited from
Section titled “Inherited from”ctx:
GenericMutationCtx<TDataModel>
Defined in: packages/core/src/hooks/types.ts:19
Inherited from
Section titled “Inherited from”id:
Id<TCollectionSlug>
Defined in: packages/core/src/collections/hooks.ts:49
newDoc
Section titled “newDoc”newDoc:
TDocument
Defined in: packages/core/src/collections/hooks.ts:51
oldDoc
Section titled “oldDoc”oldDoc:
TDocument|null
Defined in: packages/core/src/collections/hooks.ts:50
operation
Section titled “operation”operation:
"create"|"update"
Defined in: packages/core/src/collections/hooks.ts:48