fluxible-plugin-store-execute-action
A temporary solution to get the executeAction()
method on the Store Context for initiating async query actions.
This plugin will be redundant once a proper solution is implemented for yahoo/fluxible#15.
npm install fluxible-plugin-store-execute-action
Usage
Stores can execute actions via the StoreContext
. As is the case for components, store actions should be
fire and forget and, therefore, a promises is not returned nor a done callback supported. Success
or failure of the asynchronous operation should be handled by dispatching appropriate actions.
See the code examples below.
Application Bootstrap
// common.js ;app; // server.js const context = app; // When using React-Router for example:router // client.js // No special actions required.
Use within Stores
// findAction.js { return actionContextqueryUtils ;} // SomeStore.js { if thisrecordsid // Return the record if it exists. return thisrecordsid; // Or execute a query action... this; // Potentially set a 'loading' flag here. } { payloadrecords; // Clear 'loading' flags. this; } SomeStorehandlers = 'RECEIVE_RECORDS': 'handleReceiveRecords';
License
This software is free to use under the MIT license. See the LICENSE file for license text and copyright information.