Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Redux-ORM usage to work with 0.9.x
Replaced "schema" object with "orm" Used `getEmptyState()` instead of `getDefaultState()` Removed uses of `session.reduce()` - now just `return session.state` Replaced `withModels` with `toModelArray()` Updated Model classes to define attributes and use `upsert()`
- Loading branch information
1 parent
2dd6024
commit 3c19945
Showing
14 changed files
with
58 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import {createReducer} from "common/utils/reducerUtils"; | ||
|
||
import schema from "app/schema"; | ||
const defaultEditingEntities = schema.getDefaultState(); | ||
import orm from "app/schema"; | ||
const defaultEditingEntities = orm.getEmptyState(); | ||
|
||
export default createReducer(defaultEditingEntities, { | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import {Schema} from "redux-orm"; | ||
import {ORM } from "redux-orm"; | ||
|
||
import Pilot from "features/pilots/Pilot"; | ||
import MechDesign from "features/mechs/MechDesign"; | ||
import Mech from "features/mechs/Mech"; | ||
|
||
const schema = new Schema(); | ||
schema.register(Pilot, MechDesign, Mech); | ||
const orm = new ORM(); | ||
orm.register(Pilot, MechDesign, Mech); | ||
|
||
export default schema; | ||
export default orm; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import {createSelector} from "reselect"; | ||
|
||
import schema from "app/schema"; | ||
import orm from "app/schema"; | ||
|
||
|
||
export const selectEditingEntities = state => state.editingEntities; | ||
|
||
export const getEditingEntitiesSession = createSelector( | ||
selectEditingEntities, | ||
editingEntities => schema.from(editingEntities) | ||
editingEntities => orm.session(editingEntities) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import {createSelector} from "reselect"; | ||
|
||
import schema from "app/schema"; | ||
import orm from "app/schema"; | ||
|
||
export const selectEntities = state => state.entities; | ||
|
||
export const getEntitiesSession = createSelector( | ||
selectEntities, | ||
entities => schema.from(entities) | ||
entities => orm.session(entities) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters