Redux(-like) state management for Caldera Forms.
Requires npm
npm i -D caldera-state
import {state} from '@caldera-labs/state';
const STORE_SLUG = state.CALDERA_FORMS_STORE_SLUG;
This module is used was added to Caldera Forms, first for block UI and privacy settings screen. Pull request
Requires git and npm
- Clone from Github
git clone [email protected]:calderawp/caldera-state.git
- Install
cd caldera-state && npm install
- See "Available Scripts" below for more information on development
This package provides Redux(-like) state management for Caldera Forms configurations and other things that need their state managed in a React app, such as Gutenberg.
Also, an example app and test coverage for all of that.
- CalderaWP/Caldera-Forms#2564
- Once source of single source of state
- We need to state management in CF core, pro, and add-ons.
- Isolated testing.
- Test basic functionality with mocks here.
- Test that it actually works with CF REST API in CF.
import * as cfStateWebpack from '@caldera-labs/state'
This import exposes three keys: store,state, and util.
import * as cfFormsState from '@caldera-labs/state';
export const STORE = {
reducer( state = DEFAULT_STATE, action ) {
return cfFormsState.store.reducers.formsReducer(DEFAULT_STATE,action);
},
actions: cfFormsState.store.actions,
selectors: cfFormsState.store.selectors,
};
cfFormsState.util.findFormById(Array,'cf123456');
cfFormsState.util.formHasId(Object,'cf123456');
- ✔️ State management for forms.
- ✔️ State management for settings.
- ✖️ Migrate CF Pro state from Vuex to Redux.
- ✔️ Integration with wp.data.
- ✔️ Entries
In the project directory, you can run:
Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.
The page will reload if you make edits.
You will also see any lint errors in the console.
This shows the example app that uses this to show and update a list of forms.
Launches the test runner in the interactive watch mode.
Builds the app for production to the build
folder.
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.
Must be logged in as project maintainer via npm cli
-
Patch release:
yarn release
-
Minor release:
yarn release:minor
-
Major release:
yarn release:major