Skip to content

storeModelChoices ​

Overview ​

A store for lookup choices for a particular model field.

Signature ​

storeModelChoices(pinia, hot)

Parameters ​

NameTypeRequiredDescription
piniaPinianoPinia instance to retrieve the store
hotStoreGenericnodev only hot module replacement

Returns ​

Store

Properties ​

$id ​

Id of the store. Used by map helpers.

Type: "modelChoices"

Source: node_modules/.pnpm/pinia@3.0.4_typescript@5.9.3_vue@3.5.43_typescript@5.9.3_/node_modules/pinia/dist/pinia.d.ts:654

authScopeGeneration ​

Incremented by clearAuthScoped. Fetches capture it before issuing and discard their response if it changed while the request was in flight.

Type: number

Source: client/lib/stores/storeModelChoices.js:98

choices ​

Choice lists for model fields, keyed by app and model dot name, then by field name. A fetched list is the server's paginated response, with {label, value} items in results.

Type: object

Source: client/lib/stores/storeModelChoices.js:70

filterChoices ​

Choice lists for filters, keyed by app and model dot name, then by filter name. A fetched list is the server's paginated response, with {label, value} items in results.

Type: object

Source: client/lib/stores/storeModelChoices.js:77

filterPromises ​

The in-flight fetchFilterChoices requests, keyed by app and model dot name, then by filter name. A request removes its entry when it settles.

Type: object

Source: client/lib/stores/storeModelChoices.js:91

promises ​

The in-flight fetchChoices requests, keyed by app and model dot name, then by field name. A request removes its entry when it settles.

Type: object

Source: client/lib/stores/storeModelChoices.js:84

Methods ​

  • clearAuthScoped - Drops every cached choice list, because choices are row-level filtered for the authenticated user.
  • fetchChoices - Fetches the choice list for a model field and stores it in choices.
  • fetchFilterChoices - Fetches the choice list for a filter and stores it in filterChoices.
  • initializeChoice - Creates the empty per-model container in choices, or in filterChoices for a filter, if it does not exist yet.
  • setChoices - Stores a choice list for a model field without fetching it.
  • setFilterChoices - Stores a choice list for a filter without fetching it.

Source ​

client/lib/stores/storeModelChoices.js:62