Comments (8)
+1
from redux-json-api.
👍 Running into a similar issue where I'm either required to sort every time a record is updated or make another fetch after clearing out state (check for API_WILL_READ
action and clear the payload in question)
I'd be curious if changing the default behavior would be desirable (i.e preserving ordering w/ find and replace on default) or if it would be possible to add options to updateEntity
. Maybe something like updateEntity(user, { preserveOrder: true })
?
Is the behavior described by @Petesta desired?
from redux-json-api.
Personaly i think the behaviour of scrambling the data is okay.
The issue is that diffrent people uses diffrent id
's witch can either be incremental id
witch this pr #74 by @Petesta would solve, but the issue it dosen't solve the issue for people using other id
types such as UUID
.
Im not closed for the idea personally, but we need to atleast send a flag to the state updater witch key should be sorted on.
Just to be aware, that this could also affect views where a user DON'T want to have them sorted by id, and then we need to add a sorting on something that we already sorted?
from redux-json-api.
@Nopzen It's not a case of sorting by id
or any key for that matter. I was just trying to use that as an example. That may have been confusing. Here's what's currently going on.
[
{
name: 'Jordan',
title: 'engineer'
},
{
name: 'John Doe',
title: 'engineer'
},
{
name: 'Emily Jane',
title: 'engineer'
}
]
// After call to updateEntity
[
{
name: 'Jordan',
title: 'engineer'
},
{
name: 'Emily Jane',
title: 'engineer'
},
{
name: 'Sir John Doe',
title: 'engineer'
}
]
If I have a collection and pass it into a function that is supposed to update only an element of the collection I'd expect that function to preserve the structure of the collection minus the update on the element, thus also preserving whatever order it had.
Here's what I think should happen to a collection passed into a function. And in our case updateEntity
.
[
{
name: 'Jordan',
title: 'engineer'
},
{
name: 'John Doe',
title: 'engineer'
},
{
name: 'Emily Jane',
title: 'engineer'
}
]
// After call to updateEntity
[
{
name: 'Jordan',
title: 'engineer'
},
{
name: 'Sir John Doe',
title: 'engineer'
},
{
name: 'Emily Jane',
title: 'engineer'
}
]
It's an implementation detail in the code from what I can tell and currently references id
in the filter
call.
from redux-json-api.
Ahh Sorry, that is my bad @Petesta I've understood you wrong, What i then understand is that if you update key 2 in the array you expect it to be on the key 2 again, that would make sense yes. Sorry for not catching the initial idea. I'll look talk a talk with @egeriis and then get back to you or just look into the PR.
from redux-json-api.
@Petesta I did have s quick talk to @egeriis about the suggestion, we don't see why we shouldn't do this, i will have a look into your PR this week, and then lets take it from there.
Thanks for the contribution to the tool 🎉
from redux-json-api.
@Nopzen No problem 😄.
from redux-json-api.
@Petesta - Its been merged and shiped with version 1.5.3
I hope that will help you, closing.
from redux-json-api.
Related Issues (20)
- Workwith Immutable.js HOT 1
- Best Practice for 422 or 500 Errors HOT 2
- Could you guys give me an example of using json-redux-api with Axios? HOT 17
- Update hydrateStore doc example
- resource.type vs collection endpoint uris HOT 5
- Add flow-typed
- Update set up configuration page to v2 Standards HOT 8
- Delete resource endpoint appears to use relative pathing HOT 5
- Links to state HOT 5
- Update state at next readEndpoint HOT 3
- Custom URL construction HOT 11
- Action type is undefined HOT 4
- Pagination URLs can be objects.
- Unable to start expo due to Node standard library dependency of keykey HOT 1
- angular @angular-redux process not defined HOT 6
- babel-runtime must be added manually to build
- Media Types (Content Negotiation) for mutlipart/form-data content type. Request for implementation. HOT 1
- Is there any known live fork of this repo? HOT 2
- getRelatedResources crashes if relationship data is null HOT 2
- Export instance of axios that used in requests
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from redux-json-api.