Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configurable id field #7

Open
devvmh opened this issue May 23, 2016 · 4 comments
Open

Configurable id field #7

devvmh opened this issue May 23, 2016 · 4 comments

Comments

@devvmh
Copy link
Owner

devvmh commented May 23, 2016

Currently this library assumes all records have a unique id attribute. This should be configurable instead, and shouldn't be assumed to be a number.

@devvmh
Copy link
Owner Author

devvmh commented Jul 25, 2016

#19, integrating normalizr, should solve this issue

@chawax
Copy link

chawax commented May 23, 2017

Hi,
I had a problem retrieving records and I found it is because my records have a unique id but it has not the "id" name. It looks like redux-crud-store needs this to fill the ids attribute and others in state. Is this what you mean with "configurable id field" ? Do you talk about the possibility to set another name for this id attribute ?

@devvmh
Copy link
Owner Author

devvmh commented May 23, 2017

Hi, you're exactly right. I was anticipating this day haha.

I'm slowly working through removing immutable js from the lib so i dont have a lot of capacity to fix this issue. I would certainly welcome and collaborate on a pull request to implement this issue though!

@devvmh
Copy link
Owner Author

devvmh commented May 23, 2017

If course if you own the backend server it wpukf be mich simpler to replicate the contents of your existing id field and have the unique identifier available under both keys. You could even hide this behaviour under a parameter (e.g. /api/v1/posts returns a regular response, but /api/v1/posts?include_id=true returns the same response with the id key added), and then pass that parameter to the ApiClient configuration so it's included in all requests from redux crud store to your server

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants