Using Draft Data for Editing Pilots
We'll cover the following...
With those building blocks set, we can now begin updating our <PilotDetails>
form to work with the new editing logic and data.
Displaying the Copied Pilot Entry
Since we’re copying edited items from entities
to editingEntities
, our <PilotDetails>
form will need to be able to switch which slice of state it’s reading the pilot data from. We’ll add some additional logic to the mapState
function so that it can determine what slice it should use to load the data. We also need to update the action creators to actually dispatch the EDIT_ITEM_EXISTING
and EDIT_ITEM_STOP
actions at the same time as we dispatch the PILOT_EDIT_START
and PILOT_EDIT_STOP
actions.
Commit db9b7f7: Add ability to display pilot entry from “draft” editingEntities slice
features/editing/editingSelectors.js
import {createSelector} from "reselect";
import orm from "app/orm";
export const selectEditingEntities = state => state.editingEntities;
export const getEditingEntitiesSession = createSelector(
selectEditingEntities,
editingEntities => orm.session(editingEntities)
);
As with our entities
slice, we’ll ...