Service Stores
Learn about the state, getters, and actions in service stores.
Every service has a store property, which includes the following API.
Returned API
The object returned from useDataStore is built on top of the BaseModel store. Refer to the Standalone data store documentation for API details. The following sections will cover store APIs not in the BaseModel store.
The following sections cover additional APIs returned when calling useDataStore. APIs are grouped by functionality.
Additional State
serviceparamsForServerskipGetIfExistsisSsr
Model Config
Modelgives access to the Model Function provided in the options.setModel(Model)Allows setting/replacing the Model. This means you can calluseFindwithout a Model and set the model afterwards.
Pagination State
paginationkeeps track of the latest pagination data for each paginated request to the server. You generally won't manually modify this.updatePaginationForQuery()unflagSsr()
Pending State
isPendingcreatePendingByIdkeeps track of individual records, by id, that have pendingcreaterequests.updatePendingByIdkeeps track of individual records, by id, that have pendingupdaterequests.patchPendingByIdkeeps track of individual records, by id, that have pendingpatchrequests.removePendingByIdkeeps track of individual records, by id, that have pendingremoverequests.isFindPendingis a boolean computed which will be true if anyfindrequest is pending.isCountPendingis a boolean computed which will be true if anycountrequest is pending.isGetPendingis a boolean computed which will be true if anygetrequest is pending.isCreatePendingis a boolean computed which will be true if anycreaterequest is pending.isUpdatePendingis a boolean computed which will be true if anyupdaterequest is pending.isPatchPendingis a boolean computed which will be true if anypatchrequest is pending.isRemovePendingis a boolean computed which will be true if anyremoverequest is pending.setPending()allows setting a method as pending.setPendingById()allows setting a record as pending by method name and record id.unsetPendingById()allows unsetting a record's pending status.clearAllPending()resets pending state back to its original, empty state.
Event Locks
Event locks are automatically managed and require no manual upkeep.
eventLockshelps prevent receiving normal, duplicate responses from the API server during CRUD actions. Instead of processing both the CRUD response AND the realtime event data, it only handles one of them.toggleEventLock()used to toggle an event lock.clearEventLock()used to turn off an event lock