Skip to content

Commit

Permalink
Deleting a resource will not delete it from the store
Browse files Browse the repository at this point in the history
Previously, it would be set to null
  • Loading branch information
jamesplease committed Mar 15, 2018
1 parent 72d5ba2 commit c1e3013
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ function delSucceed(state, action, { initialResourceMeta }) {
let newResources = Object.assign({}, state.resources);
if (hasIds) {
idList.forEach(id => {
newResources[id] = null;
delete newResources[id];
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ export default (resourceType, { initialResourceMeta }) => (state, action) => {
let newResources = Object.assign({}, state.resources);
if (hasIds) {
idList.forEach(id => {
newResources[id] = null;
delete newResources[id];
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,8 @@ describe('reducers: DELETE_RESOURCES', function() {
...initialState,
resourceType: 'hellos',
resources: {
1: null,
3: { id: 3 },
4: { id: 4 },
13: null,
},
lists: {
bookmarks: [2, 3],
Expand Down Expand Up @@ -252,10 +250,8 @@ describe('reducers: DELETE_RESOURCES', function() {
...initialState,
resourceType: 'hellos',
resources: {
1: null,
3: { id: 3 },
4: { id: 4 },
13: null,
},
lists: {
bookmarks: [2, 3],
Expand Down Expand Up @@ -329,10 +325,8 @@ describe('reducers: DELETE_RESOURCES', function() {
...initialState,
resourceType: 'hellos',
resources: {
1: null,
3: { id: 3 },
4: { id: 4 },
13: null,
},
lists: {
bookmarks: [2, 3],
Expand Down Expand Up @@ -405,10 +399,8 @@ describe('reducers: DELETE_RESOURCES', function() {
...initialState,
resourceType: 'hellos',
resources: {
1: null,
3: { id: 3 },
4: { id: 4 },
13: null,
},
meta: {
1: {
Expand Down
18 changes: 0 additions & 18 deletions packages/redux-resource/test/unit/reducers/delete.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,6 @@ describe('reducers: delete', function() {
resourceType: 'hellos',
resources: {
1: { id: 1 },
3: null,
4: null,
},
lists: {},
requests: {},
Expand Down Expand Up @@ -275,9 +273,7 @@ describe('reducers: delete', function() {
expect(reduced).to.deep.equal({
resourceType: 'hellos',
resources: {
0: null,
3: { id: 3 },
4: null,
},
lists: {},
requests: {},
Expand Down Expand Up @@ -347,8 +343,6 @@ describe('reducers: delete', function() {
resourceType: 'hellos',
resources: {
1: { id: 1 },
3: null,
4: null,
},
lists: {},
requests: {
Expand Down Expand Up @@ -430,8 +424,6 @@ describe('reducers: delete', function() {
resourceType: 'hellos',
resources: {
1: { id: 1 },
3: null,
4: null,
},
lists: {},
requests: {
Expand Down Expand Up @@ -514,8 +506,6 @@ describe('reducers: delete', function() {
resourceType: 'hellos',
resources: {
1: { id: 1 },
3: null,
4: null,
},
lists: {},
requests: {
Expand Down Expand Up @@ -597,8 +587,6 @@ describe('reducers: delete', function() {
resourceType: 'hellos',
resources: {
1: { id: 1 },
3: null,
4: null,
},
lists: {},
requests: {
Expand Down Expand Up @@ -679,8 +667,6 @@ describe('reducers: delete', function() {
resourceType: 'hellos',
resources: {
1: { id: 1 },
3: null,
4: null,
},
lists: {},
requests: {
Expand Down Expand Up @@ -759,8 +745,6 @@ describe('reducers: delete', function() {
resourceType: 'hellos',
resources: {
1: { id: 1 },
3: null,
4: null,
},
lists: {},
requests: {
Expand Down Expand Up @@ -830,8 +814,6 @@ describe('reducers: delete', function() {
resourceType: 'hellos',
resources: {
1: { id: 1 },
3: null,
4: null,
},
lists: {
oink: [10],
Expand Down

0 comments on commit c1e3013

Please sign in to comment.